VOOZH about

URL: https://www.geeksforgeeks.org/html/html-enctype-attribute/

⇱ HTML enctype Attribute - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML enctype Attribute

Last Updated : 23 May, 2026

The enctype attribute in HTML specifies how form data should be encoded before being sent to the server. It is mainly used with the <form> tag when submitting form data using the POST method.

  • Defines the encoding type for form submission.
  • Common values include application/x-www-form-urlencoded, multipart/form-data, and text/plain.
  • Required when uploading files using <input type="file">.

Syntax: 

<form enctype="multipart/form-data">
<!-- form elements -->
</form>

Attribute Values

This attribute contains three values which are listed below:

  • application/x-www-form-urlencoded: Default encoding type that encodes form data before submission.
  • multipart/form-data: Used for file uploads without encoding characters.
  • text/plain: Sends form data in plain text format.

Supported Tag

The enctype attribute is associated with <form> element only. 

Example:  Demonstrates the enctype="multipart/form-data" attribute, used for file uploads. It includes fields for first name, last name, and address, and a submit button.

Comment
Article Tags: