The enctype attribute on a <form> sets the MIME type of the request body when the form is submitted with method="post". It controls how field names and values are packed for the server.
The default is application/x-www-form-urlencoded. Use multipart/form-data when the form includes <input type="file"> (often with accept). A submit control can override this with formenctype.
Baseline · Widely available.
Not deprecated and not experimental. Long-supported form submission attribute across modern browsers.
POST only.
enctype is ignored for method="get" (data goes in the URL). File uploads need method="post" and enctype="multipart/form-data".
Syntax
HTML Syntax
syntax.html
<form method="post" enctype="type">
In JavaScript: form.enctype = "multipart/form-data" (or read form.enctype).
enctype="text/plain" sends mostly unescaped text lines.
Spaces and symbols are not safely encoded like urlencoded.
Not for files — still use multipart for uploads.
Prefer urlencoded or multipart for real servers.
Edge Cases & Pitfalls
Most upload bugs are a missing multipart value or using GET.
files
File + default enctype fails
A file field with the default urlencoded encoding will not send usable binary data. Always pair files with multipart/form-data.
method
GET ignores enctype
Query strings cannot carry multipart bodies. Uploads need method="post".
override
formenctype wins per click
A submit button’s formenctype overrides the form for that submission only — useful when one form has two submit modes.
debug
text/plain is not for apps
Servers and frameworks expect urlencoded or multipart. Keep text/plain for experiments.
ajax
Fetch/XHR set their own headers
If you build the body in JavaScript (FormData, JSON), the form’s enctype does not apply — you set Content-Type (or let the browser set the multipart boundary).
Compatibility
Browser Support
enctype is an HTML form attribute in the browser. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
enctype
Supported everywhere modern browsers run. All three MIME values work with method=post; multipart is required for file inputs.
98%Global support (approx.)
Google ChromeAll
Full support
Mozilla FirefoxAll
Full support
Apple SafariAll
Full support
Microsoft EdgeAll
Full support
OperaAll
Full support
Samsung InternetModern
Full support
Internet ExplorerAll
Supported
enctypeWidely supported
Bottom line: Safe for all forms. Remember: multipart + POST for uploads; default urlencoded for ordinary fields.
Remember
Key Takeaways
On <form>: MIME type of the POST body.
Default:application/x-www-form-urlencoded.
Files:multipart/form-data + method="post".
Override:formenctype on a submit control.
One line:enctype chooses how POST form data is encoded — use multipart for files.
Frequently Asked Questions
On a form element, when method is post, enctype sets the MIME type of the request body: how field names and values are encoded before they are sent to the server.
application/x-www-form-urlencoded. Fields become URL-encoded name=value pairs joined with &.
Whenever the form has an input type=file. Binary file bytes cannot be sent correctly with the default urlencoded encoding.
No. GET appends data to the action URL query string. enctype only applies when the form is submitted with method=post (or when a submitter overrides method to post).
Mostly debugging. It sends mostly unencoded name=value lines. Do not use it for production forms or file uploads.
Yes. formenctype on a submit button, image input, or input type=submit overrides the form’s enctype for that submission.