The formenctype attribute sets how form data is encoded when a specific submit control is used. It overrides the form’s enctype for that click only. Use it on a <button> that submits a form, or on <input type="submit"> / type="image".
Typical case: the form defaults to urlencoded text, but one button uploads a file and needs multipart/form-data. Pair with formmethod or formaction when that button also needs a different method or URL.
Baseline · Widely available.
Not deprecated and not experimental. Stable across modern browsers since about July 2015.
Files need multipart.
If the submission includes <input type="file">, use multipart/form-data (via enctype or formenctype). Urlencoded encoding cannot send file contents correctly.
Syntax
HTML Syntax
syntax.html
<button type="submit" formenctype="encoding">
encoding is one of the three values listed below.
Values
Attribute Values
Same three encodings as enctype:
Value
Description
Try it
application/x-www-form-urlencoded
Default. Name/value pairs percent-encoded in the body (or query for GET)
One line:formenctype lets one submit button pick a different encoding without changing the whole form.
Frequently Asked Questions
On a submit button or input type=submit (or image), formenctype sets how form data is encoded for that submission. It overrides the enctype attribute on the owning form.
Three values: application/x-www-form-urlencoded (default), multipart/form-data (required for file uploads), and text/plain (mostly for debugging).
Whenever the form includes input type=file. Without multipart encoding, file contents are not sent correctly.
button (when it submits a form) and input with type=submit or type=image. It has no effect on type=button or type=reset.
enctype is set on the form and is the default encoding. formenctype is set on a specific submit control and overrides enctype when that control is used.
It is Baseline widely available (since about July 2015) in modern Chrome, Firefox, Safari, and Edge.