Skip to content
toolbelt

Base64 Image

Preview a base64 image and turn it back into a data URI, or drop in an image file to encode it. Detects PNG, JPEG, GIF, WebP and BMP from the bytes themselves.

read guide
base64 or data uri0 ln / 0 ch
data uri
ready
local / nothing uploaded

About this tool

A data URI embeds an image directly in HTML or CSS as base64 text, which removes a network request for small icons and placeholder images. This tool converts both directions and detects the image format from the file signature rather than trusting a label.

How to use it

  1. Paste base64 image data, with or without the data: prefix.
  2. The format is sniffed from the bytes and the image previewed.
  3. Copy the normalised data URI.
  4. To go the other way, choose a file and copy the generated data URI.

Examples

A 1x1 PNG

iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==
data:image/png;base64,...

Limits and notes

  • Base64 is about 33 percent larger than the binary file, so this suits small images only.
  • Huge images can be slow to render because the whole string must be parsed.

Frequently asked questions

Which formats are detected?
PNG, JPEG, GIF, WebP, BMP and ICO, identified by magic bytes at the start of the data.
Why does my string fail to decode?
Most often the padding is missing or the string was truncated when copied. Base64 length must be a multiple of four.
Should I inline all my images?
No. Data URIs cannot be cached separately and block the stylesheet. Inline small icons, keep photographs as files.

Want the details? Read the full guide: Inlining an Image Without Slowing the Page.