Skip to main content

HTML Guide

Internal encoding declaration “utf-8” disagrees with the actual encoding of the document (“windows-1252”).

The character encoding declared in the HTML differs from the actual file encoding.

The meta element with charset="utf-8" tells browsers to interpret the document as UTF-8. However, if the file is actually saved in another encoding (such as Windows-1252), validators and browsers will detect a mismatch, leading to this error. To resolve this, you must ensure the file contents and the encoding declaration match.

Recommended: Save your document in UTF-8 encoding to match your meta tag.
Alternatively, if you must use Windows-1252, update charset accordingly.

UTF-8 example (preferred):

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>UTF-8 Encoding Example</title>
    <meta charset="utf-8">
  </head>
  <body>
    <p>This page is encoded in UTF-8.</p>
  </body>
</html>

Windows-1252 example (not recommended):

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Windows-1252 Encoding Example</title>
    <meta charset="windows-1252">
  </head>
  <body>
    <p>This page is encoded in Windows-1252.</p>
  </body>
</html>

Summary:

  • Use UTF-8 as your file encoding and declare <meta charset="utf-8">.
  • Always make sure the file is saved using the same encoding you declare in the HTML.

Learn more:

Related W3C validator issues