HTML <input> formenctype Attribute

Last Updated : 25 May, 2026

The formenctype attribute is used to specify how form data should be encoded before being sent to the server. It overrides the enctype attribute of the <form> element for a specific submit button.

  • Defines the encoding type used when submitting form data.
  • Works with <input type="submit"> and <input type="image">.
  • Overrides the form’s default enctype attribute for that submission.

Syntax:

<input formenctype="value">

Attribute Values:

  • application/x-www-form-urlencoded: It is the default value. It encodes all the characters before sent to the server. It converts all spaces into "+" symbols and special character into its "hex" value.
  • multipart/form-data: This value does not encode any character.
  • text/plain: This value convert spaces into "+" symbols but special characters are not converted.
html
<!--Driver Code Starts-->

<!DOCTYPE html>
<html>

<head>
    <title>HTML input formenctype Attribute</title>
</head>

<!--Driver Code Ends-->

<body style="text-align: center">

    <h1 style="color: green">GeeksforGeeks</h1>

    <h4>HTML &lt;input&gt; formenctype Attribute</h4>

    <form action="#" method="post">

        First name:
        <input type="text" name="fname"> Last name:
        <input type="text" name="lname">
        <br>
        <br>

        <input type="submit" value="Submit" 
               formenctype="multipart/form-data">
    </form>
</body>

<!--Driver Code Starts-->

</html>

<!--Driver Code Ends-->
Comment