HTML accept-charset Attribute


The accept-charset attribute specifies the character encodings that are to be used for the form submission. This attribute is used within a <form> element to dictate which character sets the server is willing to accept for the form data. When a form is submitted, the browser uses the accept-charset attribute to encode the form data before sending it to the server.

If the accept-charset attribute is not specified, the form data will be transmitted using the charset of the document containing the form, or the default charset of the browser if the document does not specify one. Specifying this attribute can be particularly important for ensuring the correct interpretation of form input on the server, especially when dealing with internationalized content that may include characters outside of the ASCII range.

The value of this attribute can be a single charset, such as UTF-8, or a comma-separated list of charsets, indicating the server’s preference order. For example, accept-charset="UTF-8, ISO-8859-1" would indicate that the server prefers UTF-8 encoding but will also accept ISO-8859-1 if necessary.

Example usage in a form:

<form action="example.php" method="post" accept-charset="UTF-8">
  <!-- form elements here -->

In this example, the form data will be encoded as UTF-8 when submitted to the server, ensuring that any characters, including those outside the ASCII range, are correctly encoded and interpreted by the server.


<form accept-charset="character-set">


  • character-setSpace-separated list of character encodings. Common values are UTF-8 and ISO-8859-1. The default value is 'unknown'. For HTML5 pages this means that UTF-8 will be used.

Applies To

The accept-charset attribute can be used on the following html elements.


<form action="formscript.php" accept-charset="UTF-8 ISO-8859-1">
<label for="name">Name:</label><br>
<input type="text" id="name" name="name">
<label for="message">Message:</label><br>
<textarea id="message" name="message"></textarea>
<button type="submit">Submit</button>

Browser Support

The following table will show you the current browser support for the HTML accept-charset Attribute.

Edge Chrome Firefox Opera Safari
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview

Last updated by CSSPortal on: 28th March 2024