HTML <form> accept-charset Attribute Last Updated : 17 Apr, 2025 Suggest changes Share 9 Likes Like Report The HTML <form> accept-charset attribute defines which character encoding the form will use when submitting data.By default, the accept-charset attribute is set to 'UNKNOWN,' using the same encoding as the document.It ensures the correct encoding when the form is submitted, especially for non-ASCII characters.It can be set to values like 'UTF-8' to specify a specific character encoding.Syntax<form accept-charset = "character_set">The accept-charset attribute specifies the character encoding for form submission, with common values like UTF-8 or ISO-8859-1. HTML <html> <body> <form action="/submit" method="post" accept-charset="UTF-8"> <label for="name">Name:</label> <input type="text" id="name" name="name"> <input type="submit" value="Submit"> </form> </body> </html> More Examples of HTML Form Accept Basic Form with UTF-8 Encoding html <!DOCTYPE html> <html> <body> <form action="/submit" method="post" accept-charset="UTF-8"> <label for="email">Email:</label> <input type="email" id="email" name="email"> <input type="submit" value="Submit"> </form> </body> </html> The form specifies accept-charset="UTF-8", ensuring that any special characters (e.g., accents or non-ASCII letters) are correctly submitted.This encoding type is commonly used for supporting a wide range of characters.Form with Multiple Encodings HTML <!DOCTYPE html> <html> <body> <form action="/submit" method="post" accept-charset="UTF-8"> <label for="email">Email:</label> <input type="email" id="email" name="email"> <input type="submit" value="Submit"> </form> </body> </html> The accept-charset="UTF-8, ISO-8859-1" allows the form to accept either encoding, depending on the browser's default or user preference.This flexibility ensures compatibility with a broader range of devices and languages.Best Practices for Using the <form> accept-charset AttributeSet explicit encoding for internationalization: Always define an encoding like UTF-8 to ensure compatibility with different languages and characters, especially if the form handles non-ASCII input.Ensure consistency across forms: If your site uses multiple forms, set the accept-charset attribute consistently across all forms to avoid any unexpected character encoding issues.Avoid unnecessary attribute values: Only use accept-charset when necessary, and avoid including multiple encoding types unless you have specific requirements. Create Quiz M manaschhabra2 Follow 9 Article Tags : Web Technologies HTML HTML-Attributes Explore HTML BasicsHTML Introduction4 min readHTML Editors4 min readHTML Basics7 min readStructure & ElementsHTML Elements4 min readHTML Attributes7 min readHTML Headings3 min readHTML Paragraphs3 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists3 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks2 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables9 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms4 min readHTML5 Semantics5 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List5 min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read My Profile ${profileImgHtml} My Profile Edit Profile My Courses Join Community Transactions Logout Like