Meta Charset UTF-8: How to Declare Your Page's Character Encoding
What the charset declaration does, why UTF-8 is the encoding to use, and how our free SEO report tests it on your page.
Free to use 5 min read Updated Oct 2026
What Is Meta Charset UTF-8? The Short Answer
Quick answer: Meta charset utf-8 is a tag in the head, written
<meta charset="utf-8">, that tells browsers to read the page's bytes as UTF-8 text. Our free report checks for it in the rendered HTML, and you can run it without creating an account.
- Pass: the rendered HTML has a meta tag with a non-empty charset value.
- Fail: no declaration is found.
- Fix: add the tag first in the head.
What Does Meta Charset UTF-8 Do in HTML?
A browser receives bytes, not letters, so it needs to know the character set. UTF-8 covers every Unicode character, and the W3Techs survey says about 99 percent of sites with a known encoding use it.
<meta charset="utf-8"><meta http-equiv="Content-Type" content="text/html; charset=utf-8">The first block is the current form and the second is the older pragma directive. Use one, never both. The HTML Standard on encoding declarations allows one per document, inside the first 1024 bytes, with utf-8 as the only valid value, so iso-8859-1 or windows-1252 is a legacy leftover.
The beginner guide to what meta tags are covers the wider family of head tags.
Why Does the Charset Declaration Matter for SEO and Users?
It is not a documented ranking factor, so the harm is indirect. When charset sniffing guesses wrong, an apostrophe in a title becomes ’, an é in a product name becomes é, and a currency symbol can turn into a replacement character. Searchers who see that lose trust.
A declaration found late can force the browser to parse the page again, so keep it in the first 1024 bytes. The URL encoder and decoder shows the UTF-8 bytes behind an encoded URL. An encoding mismatch elsewhere breaks text even when the tag is right: a MySQL utf8mb4 database stores 4 byte emoji, but the old utf8 charset cannot.
How SEO Site Checker Tests Your Charset Declaration
Our audit parses the HTML rendered by headless Chromium. Run the free website SEO score checker on your own page.
Exact rule: a non-empty meta charset attribute passes, as does an http-equiv Content-Type tag holding charset=VALUE. There is no warning state.
What passes
A pass prints "This webpage has a character encoding declaration" with the value read. Any non-empty value counts, and the pragma form needs charset=VALUE with no spaces.
What fails
An empty first charset attribute fails even if a later meta charset tag is valid. The pragma form is stricter: lowercase content-type fails, and so do charset = utf-8 with spaces and charset='utf-8' with quotes. The report then prints "This webpage doesn't have a character encoding declaration" and a red How to Fix button.
What the check does not test
We don't read the HTTP header, so a header-only fix stays red. We also skip the 1024 byte limit, tag position, duplicates and the value, so iso-8859-1 passes though the standard calls it non-conforming. A tag in the body or one injected by JavaScript also passes, so a pass can hide a declaration that does not work.
How to Add Meta Charset UTF-8 to Your Page
- Open the head template. Keep the doctype on line one, as the doctype guide explains, then make the charset tag the first element in head.
- Save as UTF-8. The tag is true only if the bytes match.
- Remove duplicates, then verify. A theme and a plugin often print two. Clear caches and run the report again. The Lighthouse charset audit is a fair cross-check, though it also accepts a header.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Your page title</title>Check the header and the first 1024 bytes
The first command prints the response header, which alone won't pass our check. The second tests the 1024 byte limit, and no output means the tag is late or missing.
curl -sD - -o /dev/null https://example.com/ | grep -i content-type
curl -s https://example.com/ | head -c 1024 | grep -io 'charset[^>]*'Meta Charset UTF-8 in WordPress, Shopify, Apache and Nginx
Encoding sniffing ranks a byte order mark first, the Content-Type response header second and the meta tag, found by a prescan of 1024 bytes, third. Treat the header as a safety net, not a substitute.
| Platform | Where | What to use |
|---|---|---|
| WordPress classic | header.php | <meta charset="<?php bloginfo( 'charset' ); ?>"> |
| Shopify | theme.liquid | <meta charset="utf-8"> |
| Apache | .htaccess or server config | AddDefaultCharset utf-8 |
| Nginx | server block | charset utf-8; |
| PHP | php.ini | default_charset = "UTF-8" |
Hosted builders and block themes print the head, so a failure there usually means custom code or caching. On Apache, write utf-8, because AddDefaultCharset On means iso-8859-1. The W3C guide to encoding declarations advises keeping the tag anyway.
Meta Charset UTF-8 Mistakes That Cause Garbled Text
Lighthouse reports "Charset declaration is missing or occurs too late" and the W3C validator says "The character encoding was not declared". Either way, put the tag first in the head.
- Tag too late. Inline CSS above it can push it past byte 1024.
- Wrong file encoding. A windows-1252 file declared as utf-8 shows replacement characters, so re-save it as UTF-8 without a BOM.
- Header disagrees. If the server sends charset=iso-8859-1 and the tag says utf-8, the header wins.
- Duplicate or empty tag. Search the source for charset to find extra copies.
How to Fix
The short version, the same steps you see when you click How to Fix in your report.
Why this fails: the rendered HTML of your page has no meta tag naming a character encoding, so browsers must guess and special characters can show as garbage. Our report reads the HTML, so a server header on its own does not clear this check.
How to fix it:
- Open the template that prints your head tag.
- Add the charset tag as the very first element inside the head, before the title, links and scripts.
- Keep the doctype on line one, above the html tag.
- Save the file as UTF-8 so the declaration is true.
- Publish the change and clear page and CDN caches.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Your page title</title>Platform variants: on WordPress classic themes, print the tag in header.php with this line. Block themes print it automatically.
<meta charset="<?php bloginfo( 'charset' ); ?>">On Shopify, put the tag at the top of the head in theme.liquid. Apache and Nginx can add the charset to the Content-Type header as a backup, and the report still needs the meta tag. For Apache, add this line to .htaccess, and use the value utf-8 because On means iso-8859-1:
AddDefaultCharset utf-8For Nginx, add this line to your server block:
charset utf-8;Pitfalls: keep only one declaration and never leave the charset value empty. If you use the older http-equiv form, write Content-Type exactly and put no spaces around the equals sign. The short meta charset form is safer.
Re-test: view the page source and confirm the tag sits within the first 1024 bytes, then run our free report again. The Charset Declaration check turns green and the badge shows the value it found. You can re-run the free SEO check right away.
Frequently Asked Questions
What does meta charset utf-8 do in HTML?
Where should I put meta charset utf-8?
Is meta charset utf-8 necessary?
What happens if a page has no character encoding declaration?
Is meta charset utf-8 case sensitive?
What is the difference between meta charset and meta http-equiv Content-Type?
See how your site scores right now
Paste your address into the free report, then use the How to Fix button on anything that needs work.
Free to use. Results in under a minute for most sites.