---
title: "Declare UTF-8 first · Agent Wranglers"
url: https://agentwranglers.se/playbook/website/html-basics/meta-charset
updated: 2026-10-20
licence: "All rights reserved"
---

# Declare UTF-8 first

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [HTML basics](https://agentwranglers.se/playbook/website/html-basics)
- Rule: Make `<meta charset="utf-8">` the first element in `<head>`, inside the first 1024 bytes. Send the same character set in the `Content-Type` header.
- How: Put `<meta charset="utf-8">` before the title and any script. Set `Content-Type: text/html; charset=utf-8` on the server.
- Check: The tag sits near the top, before byte 1024 of the response, and the header says the same.

Example:

```http
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
```

```html
<head>
  <meta charset="utf-8">
  <title>Page name · Example</title>
</head>
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers website playbook: https://agentwranglers.se/playbook/website/html-basics/meta-charset`.

- Previous: [Say the page's language](https://agentwranglers.se/playbook/website/html-basics/html-lang)
- Next: [Fit the page to the phone](https://agentwranglers.se/playbook/website/html-basics/meta-viewport)
- [HTML basics](https://agentwranglers.se/playbook/website/html-basics)
