An HTML charset (character encoding) tells the browser how to read the bytes in your .html file as letters, numbers, and symbols. Without a clear declaration, accents, emoji, and other languages can appear as garbage text.
What do you put in the HTML document?
In the <head>, add <meta charset="UTF-8"> as early as possible. In HTML5, UTF-8 is the encoding you should declare.
Why does position matter?
The charset declaration must appear within the first 1024 bytes of the document so the browser can decode the rest of the file correctly—including the title and body text.
Charset vs Unicode vs entities
Unicode is the character catalog; UTF-8 is how those characters are stored as bytes; entities (like &) are escape codes inside markup. See also Unicode and HTML entities.
One required line.
Every modern HTML page should include <meta charset="UTF-8"> near the top of <head>.
Meta tag and file must match.
Declaring UTF-8 is not enough if your editor saved the file as ANSI / Windows-1252. Save as UTF-8 too.
Tutorial vs attribute page.
This page teaches encoding for whole HTML documents. The charset attribute reference covers the attribute itself in more isolation.
UTF-8 lets one page display text from many languages and scripts.
Always save your .html file as UTF-8 in your editor too.
How It Works
DOCTYPE + lang + charset start a solid HTML5 page.
viewport helps mobile layout (separate from encoding).
International text works when UTF-8 is declared and saved.
Try It opens the full editable document.
Edge Cases & Pitfalls
Most charset bugs are declaration/file mismatches or a meta tag placed too late.
mismatch
Declare UTF-8, save as ANSI
Classic mojibake. Always save the .html file as UTF-8 in the editor.
late
Charset after a long title or scripts
Keep meta charset within the first 1024 bytes—usually the first line in head.
legacy
Starting new sites on ISO-8859-1
Use UTF-8 for new HTML5 projects. Legacy encodings limit languages and emoji.
guess
Omitting charset entirely
Browsers may guess wrong. Always declare UTF-8 explicitly.
server
HTTP header disagrees with the page
Prefer aligning the server Content-Type charset with UTF-8 as well.
syntax
Relying on UTF-8 for < and &
Those characters still need entities (<, &) inside HTML text.
Compatibility
Browser Support
meta charset and UTF-8 HTML documents are Baseline and supported everywhere modern browsers run. Always declare encoding early in head.
✓ Baseline · Widely available
UTF-8 in HTML
Character encoding declarations via meta charset work across all current browsers.
100%meta charset
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
HTML charsetUniversal
Bottom line: Put meta charset="UTF-8" first in head, save the file as UTF-8, and your text stays readable worldwide.
Remember
Key Takeaways
<meta charset="UTF-8"> belongs near the top of every HTML head.
Save the file as UTF-8 so the declaration matches the bytes on disk.
UTF-8 covers languages and emoji; ASCII alone does not.
Entities still escape < and & inside markup.
One line: Put <meta charset="UTF-8"> first in head, save the file as UTF-8, and your HTML can show the world’s text correctly.
Frequently Asked Questions
Charset (character encoding) tells the browser how to turn the bytes in your HTML file into letters, numbers, and symbols. UTF-8 is the standard for modern HTML pages.
Put <meta charset="UTF-8"> inside <head>, as early as possible (within the first 1024 bytes). HTML5 uses this short form instead of the older http-equiv Content-Type line.
UTF-8 covers virtually all languages and emoji, stays compatible with plain ASCII English, and is the only encoding HTML5 documents should declare.
Unicode is the catalog of characters (code points). UTF-8 is one way to store those characters as bytes. HTML pages almost always use UTF-8 to represent Unicode text.
You can type most characters directly in a UTF-8 file. Entities are still needed for characters that are special in HTML syntax, such as < (<) and & (&).