# Bad value “favicon” for attribute “type” on element “link”: Subtype missing.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-favicon-for-attribute-type-on-element-link-subtype-missing
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

MIME types (also called media types) follow a strict `type/subtype` structure as defined by IETF standards. For example, `image/png` has the type `image` and the subtype `png`. The value `"favicon"` doesn't follow this format — it has no slash and no subtype — so the validator reports "Subtype missing." This is a common mistake that happens when developers confuse the purpose of the icon (a favicon) with the format of the file (an image in a specific encoding).

While most browsers are forgiving and will still display the favicon even with an invalid `type` value, using incorrect MIME types can cause issues. Some browsers or tools may ignore the `<link>` element entirely if the `type` doesn't match a recognized format. It also hurts standards compliance and makes your HTML less predictable across different environments.

The correct MIME type depends on the file format of your favicon:

- `.ico` files: `image/x-icon` (or `image/vnd.microsoft.icon`)
- `.png` files: `image/png`
- `.svg` files: `image/svg+xml`
- `.gif` files: `image/gif`

It's also worth noting that the `type` attribute on `<link rel="icon">` is entirely optional. If omitted, the browser will determine the file type from the server's `Content-Type` header or by inspecting the file itself. Removing it is a perfectly valid fix.

## Examples

### ❌ Invalid: using "favicon" as the type

```html
<link rel="icon" href="/favicon.png" type="favicon">
```

The value `"favicon"` is not a valid MIME type, triggering the validation error.

### ✅ Fixed: using the correct MIME type for a PNG favicon

```html
<link rel="icon" href="/favicon.png" type="image/png">
```

### ✅ Fixed: using the correct MIME type for an ICO favicon

```html
<link rel="icon" href="/favicon.ico" type="image/x-icon">
```

### ✅ Fixed: using the correct MIME type for an SVG favicon

```html
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
```

### ✅ Fixed: omitting the type attribute entirely

```html
<link rel="icon" href="/favicon.png">
```

Since the `type` attribute is optional for `<link rel="icon">`, removing it avoids the error and lets the browser detect the format automatically. This is often the simplest and most maintainable approach.
