Last Updated : 11 Jul, 2025
The accept-charset attribute is used to define the character encoding and is used for form submission. The default value of the accept-charset attribute is "UNKNOWN" string which indicates the encoding equals to the encoding of the document containing the <form> element.
Syntax:
<form accept-charset = "character_set">
Attribute Value: The attribute value contains the list-separated value of one or more encoding attributes. The common value of the encoding attribute is UTF-8, ISO-8859-1. This attribute is always associated with the form element only.
Example: In this example, we are using the accept-charset attribute within a form. It specifies "UTF-8" as the character encoding for data submission, ensuring proper handling of text inputs.
html
<!DOCTYPE html>
<html>
<head>
<title>accept-charset attribute</title>
<style>
h1 {
color:green;
}
body {
text-align:center;
}
</style>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>accept-charset Attribute</h2>
<form action="#" accept-charset="UTF-8">
First name:<input type="text"
name="fname">
<br>
Last name:<input type="text"
name="lname">
<br>
<input type="submit"
value="Submit">
</form>
</body>
</html>
Output:
Supported Browsers: The browser supported by accept-charset attribute are listed below:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4