References

Beginner-friendly references for web development, with live, editable examples.

The HTML accept-charset attribute

Attribute All modern browsers Updated
Quick answer

The HTML accept-charset attribute specifies the character encodings the server accepts for the submitted form data. It is used on the <form> element.

Overview

The accept-charset attribute specifies the character encodings the server accepts for the submitted form data. It applies to the <form> element.

It is rarely needed today: serve your pages as UTF-8 (via <meta charset="utf-8">) and forms are submitted as UTF-8 automatically.

Syntax

<form accept-charset="utf-8"> … </form>

Values

Value
A space-separated list of character encodings — in practice always utf-8.

Best practices

  • Use method="post" for submissions that change data and method="get" for searches and filters.
  • Set enctype="multipart/form-data" when the form uploads files.
  • Prefer native validation over novalidate; only skip validation deliberately.
  • Always process and re-validate the submission on the server.

Frequently asked questions

What does the accept-charset attribute do?
Sets the character encodings a form accepts.
What is the difference between GET and POST?
GET appends the data to the URL (good for searches and bookmarkable results); POST sends it in the request body (used for actions that change data).
How do I let a form upload files?
Set method="post" and enctype="multipart/form-data" on the <form>.
Which elements use the accept-charset attribute?
It is an element-specific attribute, used on the <form> element.