Skip to content
Related Articles

Related Articles

What is formenctype Attribute in HTML Form ?

Improve Article
Save Article
  • Last Updated : 22 Oct, 2021
Improve Article
Save Article

The HTML formenctype attribute is used to specify the type of encoding to be used when submitting the form. It defines how the form data should be encoded when it is sent to the server. 

It works with input type submitand input type image“. 

The formenctype attribute is used when there are multiple submit buttons inside the form. It is used to override the feature of the enctype attribute of the <form> element.


<element_name formenctype=”application/x-www-form-urlencoded/multipart/form-data/text/plain”>

Basically, there are ways to be used to encode the form data.

  • application/x-www-form-urlencoded: It is the default value. It encodes all the characters before being sent to the server. It converts spaces into + symbols and special characters into its hex value.
  • multipart/form-data: It is used to encode the file upload controls. This value does not encode any character. we can not upload images and files without using this encoding type.
  • text/plain: This value converts spaces into + symbols but special characters are not converted.



<!DOCTYPE html>
        <h2 style="color:green">
            What is formenctype attribute in HTML form?
        <form action="#">
            <label>First Name:<input type="text"></label>
            <label>last Name:<input type="text"></label>
            <label>Address:<input type="text"></label>
            <input type="submit" value=
                "Submit with default encoding type">
            <button type="submit" 
                Submit as multipart form-data


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!