HTML accept-charset Attribute

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The accept-charset attribute on a <form> states the character encoding the server accepts for submitted data. Per the HTML specification, the only allowed value is a case-insensitive match for UTF-8.

Always declare the page itself as UTF-8 with <meta charset="UTF-8">. Browsers typically submit form data in the document encoding; accept-charset="UTF-8" makes that expectation explicit on the form.

Baseline · Widely available.

Not deprecated and not experimental. Stable on <form> across modern browsers since about July 2015.

Spec change.

Older HTML allowed several encodings (comma- or space-separated). Current HTML allows only UTF-8. Prefer UTF-8 pages and forms; do not rely on legacy encoding lists.

HTML Syntax

syntax.html
<form accept-charset=" UTF-8"> … </form>

Value is case-insensitive (utf-8 and UTF-8 both match the spec).

Attribute Values

What you may put in accept-charset today — and what you may still see in old code:

ValueDescriptionTry it
UTF-8The only value allowed by the current HTML specification (case-insensitive)Try it
utf-8Same as UTF-8 — matching is ASCII case-insensitiveTry it
OmittedForm follows the document encoding (use a UTF-8 page)Try it
Legacy listsHistorical multi-encoding lists (e.g. UTF-8, ISO-8859-1) — not valid in current HTMLTry it

Live Preview

Toggle accept-charset on a sample form. Submit is blocked so you can inspect the attribute safely.

Spec value is UTF-8 only. Omitting the attribute uses the document encoding.

Form

accept-charset="UTF-8"

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Declare UTF-8 on the Form

The standard, spec-correct value.

HTML
<form action="/subscribe" method="get" accept-charset="UTF-8">
  <label for="email">Email:</label>
  <input type="email" id="email" name="email" required>
  <button type="submit">Subscribe</button>
</form>
Try It Yourself

How It Works

  1. Put it on form. accept-charset belongs on <form>, not on inputs.
  2. Use UTF-8. That is the only value the current HTML spec allows.
  3. Case does not matter. UTF-8 and utf-8 both match.
  4. Label the control. Accessibility stays the same as any other form.

Example 2 — POST Form with UTF-8

Pair encoding with method and action.

HTML
<form
  action="/contact"
  method="post"
  accept-charset="UTF-8"
  enctype="application/x-www-form-urlencoded">
  <label for="message">Message:</label>
  <textarea id="message" name="message" rows="3"></textarea>
  <button type="submit">Send</button>
</form>
Try It Yourself

How It Works

  1. method="post" sends fields in the request body.
  2. accept-charset="UTF-8" documents the encoding for that body.
  3. enctype sets the body format (default URL-encoded is fine for text).
  4. Server still checks encoding — do not trust the attribute alone.

Example 3 — Page Charset + Form Charset

Declare UTF-8 for the document and the form together.

HTML
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Feedback</title>
</head>
<body>
  <form action="/feedback" method="post" accept-charset="UTF-8">
    <label for="note">Feedback:</label>
    <input type="text" id="note" name="note">
    <button type="submit">Send</button>
  </form>
</body>
</html>
Try It Yourself

How It Works

  1. meta charset tells the browser how to decode the HTML file.
  2. accept-charset tells how form data should be encoded on submit.
  3. Keep both UTF-8 so international text round-trips cleanly.
  4. They are different attributes — do not confuse with accept (file types).

Edge Cases & Pitfalls

Most confusion is mix-ups with other charset-related attributes.

spec

Only UTF-8 is valid now

Do not list ISO-8859-1 or multiple encodings. Current HTML allows a single case-insensitive UTF-8.

page first

Serve the page as UTF-8

W3C guidance: use UTF-8 for the document. Browsers usually submit in the page encoding whether or not you set accept-charset.

not accept

Different from accept

accept filters file types. The old accept on <form> is deprecated — use file inputs instead.

scope

Form only

Putting accept-charset on an <input> has no effect. It is a form attribute.

JS

DOM property is acceptCharset

In scripts, read or set form.acceptCharset — camelCase for the same attribute.

Browser Support

accept-charset is an HTML form attribute in the browser. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

accept-charset

Widely available since about July 2015 on form elements. Use UTF-8 everywhere; legacy multi-encoding lists are obsolete in the HTML living standard.

98% Form attribute support
Google Chrome All modern
Full support
Mozilla Firefox All modern
Full support
Apple Safari All modern
Full support
Microsoft Edge All modern
Full support
Opera All modern
Full support
Samsung Internet All modern
Full support
Internet Explorer Supported (legacy encodings possible)
Supported
accept-charset Widely supported

Bottom line: Safe to use. Prefer UTF-8 pages and accept-charset="UTF-8". Do not depend on obsolete multi-encoding lists.

Key Takeaways

  • Role: declare the form submission character encoding.
  • Value: only UTF-8 (case-insensitive) in current HTML.
  • Element: <form> only — not inputs.
  • Also set <meta charset="UTF-8"> on the page.

One line: accept-charset="UTF-8" on the form — and serve the page as UTF-8 too.

Frequently Asked Questions

On a form, it states the character encoding the server accepts for submitted data. The HTML specification allows a single case-insensitive value: UTF-8.
Only the form element. It does not apply to input or other controls.
Yes in current HTML. Older pages sometimes listed several encodings (for example ISO-8859-1). That multi-value pattern is historical; the spec now requires UTF-8.
Yes. Serve and declare the page as UTF-8 with meta charset. Browsers submit form data in the page encoding; accept-charset documents the expected submission encoding.
No. accept filters file types on input type=file. accept-charset sets the form submission character encoding.
Use the form’s acceptCharset property, which reflects the accept-charset HTML attribute.

Next: accesskey

Add a keyboard shortcut to focus or activate an element.

accesskey tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful