---
title: "What should go in the head of an HTML page in 2026?"
description: "A modern HTML head needs only a handful of tags: charset, viewport, title, description, canonical, icons and theme-color. Here is a clean template and what you can safely drop."
url: https://www.danny.engineering/answer/html/what-should-go-in-the-head-of-an-html-page-in-2026
author: Danny
published: 2026-11-27T00:00:00.000Z
updated: 2026-11-27T20:31:00.000Z
tags: ["HTML"]
---

# What should go in the head of an HTML page in 2026?

## The short answer


Most pages need fewer tags than old boilerplates suggest. Start with a charset, a viewport, a unique title and description, a canonical URL, your icons and an optional theme colour. Then add stylesheets and scripts.


```html
<!doctype html>
<html lang="en-GB">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Pricing | Acme</title>
    <meta name="description" content="Simple monthly plans for teams of any size.">
    <link rel="canonical" href="https://acme.example/pricing">
    <link rel="icon" href="/favicon.ico" sizes="32x32">
    <link rel="icon" href="/icon.svg" type="image/svg+xml">
    <link rel="apple-touch-icon" href="/apple-touch-icon.png">
    <link rel="manifest" href="/manifest.webmanifest">
    <meta name="theme-color" content="#0f172a">
    <link rel="stylesheet" href="/styles.css">
    <script src="/app.js" type="module"></script>
  </head>
```


## Why it happens


The head has collected decades of tags for browsers that no longer exist. Many templates still ship tags for old Internet Explorer modes, Windows tiles and search engines that stopped reading them years ago. Each extra tag is a few bytes, but more importantly it is noise that makes the important tags harder to spot and maintain.


The tags that still matter fall into three groups: ones the browser needs to parse and lay out the page, ones search engines and social sites read, and ones that control how your site looks when it is installed or saved.


## How to fix it


### Charset first


`meta charset="utf-8"` must appear within the first 1024 bytes of the document, so put it first in the head. Without it, browsers may guess the encoding and show garbled characters. UTF-8 is the only value you should use.


### Viewport


`width=device-width, initial-scale=1` tells mobile browsers to use the real device width rather than a zoomed-out desktop layout. Do not add `maximum-scale=1` or `user-scalable=no`, which stop people zooming in.


### Title and description


The `title` is shown in the tab, in bookmarks and as the headline in search results. Make it unique per page and put the specific part first, such as "Pricing | Acme". The meta description is not a ranking factor, but search engines often use it as the snippet under your link, so write one sentence that describes the page.


### Canonical


`link rel="canonical"` tells search engines which URL is the main version of the page when the same content is reachable through several URLs, for example with tracking parameters or trailing slashes. Use an absolute URL.


### Icons and manifest


A small set covers almost everything: a 32 pixel `favicon.ico`, an SVG icon for modern browsers, a 180 pixel `apple-touch-icon` for iOS home screens, and a web app manifest that lists larger PNG icons for Android and installed apps.


### Theme colour


`meta name="theme-color"` lets some browsers tint their interface to match your site, mostly on mobile. Others ignore it. You can give separate values for light and dark mode with the `media` attribute.


```html
<meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#0f172a" media="(prefers-color-scheme: dark)">
```


### Social previews


If the page is likely to be shared, add Open Graph tags such as `og:title` and `og:image`. They are optional for the page to work but control how links look in chat apps and social feeds.


### What you can drop


```html
<!-- None of these are needed any more -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="keywords" content="...">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="shortcut icon" href="/favicon.ico">
<meta name="msapplication-TileColor" content="...">
<script type="text/javascript" src="/app.js"></script>
<link rel="stylesheet" type="text/css" href="/styles.css">
```

- `X-UA-Compatible` only affected Internet Explorer, which is retired.
- Major search engines ignore meta keywords.
- The long `Content-Type` form is replaced by the short `meta charset`.
- `shortcut` in `rel="shortcut icon"` was never needed; `rel="icon"` is enough.
- `msapplication` tiles were for pinned sites on old Windows versions.
- `type="text/javascript"` and `type="text/css"` are the defaults.

## Common pitfalls

- **Missing lang on the html element.** It is not in the head, but screen readers use it to pick a voice and pronunciation. Set it every time.
- **Copying the same title and description to every page.** Search results then look identical and users cannot tell pages apart.
- **Relative canonical URLs.** They usually work, but absolute URLs avoid mistakes on staging domains and proxies.
- **Blocking scripts in the head.** A classic `script` tag without `defer` or `type="module"` stops parsing until it downloads and runs.
- **Disabling zoom in the viewport tag.** It is an accessibility failure and most mobile browsers now ignore it anyway.

## Related reading

- [MDN: The head element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/head)
- [MDN: meta name="theme-color"](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/meta/name/theme-color)
