devkult_
tools29converters34
home/mime/.png

.png MIME type

PNG imageimages

image/png

Lossless raster images with transparency.

MIME typeimage/png
Extensions.png
Content-Typeimage/png
Compress in transit?No — already compressed
File signature89 50 4E 47 0D 0A 1A 0A (.PNG....)

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.

Serve .png files with the right type

The response header to send:

Content-Type: image/png

Most servers pick the type from the file extension. If yours sends the wrong one, map it explicitly:

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">

Check it

See what a server sends for a file, and what type a local file really is by its contents:

curl -sI https://example.com/file.png | grep -i '^content-type:'
file --mime-type file.png

Frequently asked questions

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

Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options