# .png MIME Type: image/png

> Lossless raster images with transparency.

- MIME type: `image/png`
- Extensions: .png
- Content-Type header: `image/png`
- Compress in transit: no (already compressed)
- File signature: `89 50 4E 47 0D 0A 1A 0A`

## Good to know

- Already compressed — gzip or Brotli gain almost nothing, so servers shouldn't compress PNGs.
- For photos, WebP or AVIF are usually much smaller; keep PNG for screenshots, UI and images that need exact pixels.

## Server configuration

### nginx (inside the types block in mime.types)

```
image/png png;
```

### Apache (.htaccess or server config)

```
AddType image/png .png
```

### Express

```
res.set("Content-Type", "image/png");
```

### Python

```
import mimetypes

mimetypes.add_type("image/png", ".png")
```

### HTML file input

```
<input type="file" accept=".png,image/png">
```

## FAQ

### What is the MIME type for .png files?

`image/png`.

### What Content-Type header should a .png file be served with?

`Content-Type: image/png`. It's already compressed, so servers shouldn't gzip it.

### How can I tell if a file is really a .png?

Check its bytes rather than the extension: PNG files start with `89 50 4E 47 0D 0A 1A 0A` (`.PNG....`). On the command line, `file --mime-type name.png` does this for you.

## Related types

- [.jpg — image/jpeg](https://www.devkult.com/mime/jpg.md)
- [.webp — image/webp](https://www.devkult.com/mime/webp.md)
- [.avif — image/avif](https://www.devkult.com/mime/avif.md)
- [.gif — image/gif](https://www.devkult.com/mime/gif.md)

Open the interactive page: https://www.devkult.com/mime/png