HTML Guides for UTF-8
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
HTML documents must use UTF-8 as their character encoding. The legacy encoding iso-8859-15 is no longer allowed in modern HTML.
The HTML living standard requires all documents to be encoded in UTF-8. Older encodings like iso-8859-15 (also known as Latin-9) were common in the past, especially for Western European languages, but they are now considered legacy. UTF-8 supports virtually all characters from every writing system, making it the universal standard for the web.
To fix this, you need to do two things. First, update the <meta> charset declaration in your HTML to specify UTF-8. Second — and this is the important part — you must actually save or convert the file itself to UTF-8 encoding. Simply changing the meta tag without re-encoding the file can cause characters like é, ñ, or € to display incorrectly.
Most modern code editors (VS Code, Sublime Text, Notepad++) let you change the file encoding. In VS Code, click the encoding label in the bottom status bar and choose "Save with Encoding" → "UTF-8".
If your server is sending an iso-8859-15 charset in the HTTP Content-Type header, you'll also need to update that. The HTTP header takes precedence over the meta tag.
HTML Examples
❌ Incorrect: legacy encoding
<!DOCTYPE html>
<htmllang="fr">
<head>
<metacharset="iso-8859-15">
<title>Mon site</title>
</head>
<body>
<p>Bienvenue sur mon site € 2025</p>
</body>
</html>
✅ Correct: UTF-8 encoding
<!DOCTYPE html>
<htmllang="fr">
<head>
<metacharset="utf-8">
<title>Mon site</title>
</head>
<body>
<p>Bienvenue sur mon site € 2025</p>
</body>
</html>
If you're using an Apache server, update your .htaccess or server config:
AddDefaultCharset UTF-8
For Nginx, update the server block:
charset utf-8;
All HTML documents must use UTF-8 character encoding. The shift_jis encoding is a legacy Japanese encoding that is no longer valid in modern HTML.
The HTML specification requires UTF-8 as the only permitted character encoding for HTML documents. This rule applies regardless of the document's language or the characters it contains. Legacy encodings like shift_jis, euc-jp, iso-8859-1, and others are not allowed.
To fix this, two things need to happen. First, the <meta> charset declaration must specify UTF-8. Second, the file itself must actually be saved with UTF-8 encoding. Declaring UTF-8 in the markup while the file is saved as Shift_JIS will cause garbled text (mojibake). Most modern text editors and IDEs (VS Code, Sublime Text, Notepad++) can convert a file's encoding through a "Save with Encoding" or "Reopen with Encoding" option.
If a server sends a Content-Type header with charset=shift_jis, that header also needs to be updated to charset=utf-8. The HTTP header takes precedence over the <meta> tag, so fixing only the HTML is not enough if the server overrides it.
HTML examples
Before (invalid)
<!doctype html>
<htmllang="ja">
<head>
<metacharset="shift_jis">
<title>Example</title>
</head>
<body>
<p>日本語のテキスト</p>
</body>
</html>
After (valid)
<!doctype html>
<htmllang="ja">
<head>
<metacharset="utf-8">
<title>Example</title>
</head>
<body>
<p>日本語のテキスト</p>
</body>
</html>
Make sure the file is also saved as UTF-8 in your text editor. In VS Code, click the encoding label in the bottom status bar and select "Save with Encoding" then "UTF-8".
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
Pro Trial
Full Pro access. Cancel anytime.
Start Pro Trial →Join teams across 40+ countries