Skip to content
Image Reshaper

← Available tools

Image tool

Image to Base64

Get a data URL you can paste into HTML, CSS, or JSON. The file is encoded on your device.

What Base64 encoding is for

Base64 represents binary data using a limited set of text characters. Encoding an image this way lets you embed the picture directly inside a text file rather than referencing a separate image on disk or over the network. The result is a data URL that begins with a prefix describing the media type and continues with a long run of encoded characters.

The practical benefit is eliminating a request. A small icon embedded as a data URL arrives with the HTML or stylesheet that references it, so the browser does not make a separate round trip to fetch it. For a handful of tiny assets on a latency-sensitive page, that can be worthwhile.

Where it genuinely helps

Base64 earns its place in a few specific situations, all involving small images or environments where an external file is awkward to manage.

  • Tiny interface icons inlined in CSS, where an extra request costs more than the bytes.
  • Email templates, since many clients block externally hosted images by default but render inline data.
  • Test fixtures and snapshot tests that need a deterministic image without a binary file in the repository.
  • Single-file HTML documents or exported reports that must work with no accompanying assets.
  • Configuration and JSON payloads where a binary attachment is not an option.

Why it is a poor default

Base64 is not a compression format; it is an encoding, and it makes data larger. Every three bytes of binary become four characters of text, so the encoded form is roughly a third bigger than the original file before you account for the data URL prefix. A 2 MB photograph becomes an unwieldy string of well over 2.7 MB embedded in your markup.

Inlined data also cannot be cached independently. A referenced image file is downloaded once and reused across every page that points at it, but a data URL is re-downloaded as part of every document containing it. Inlining a logo across fifty pages means shipping that logo fifty times. Large strings slow down editors, bloat diffs, and make source files painful to review.

Keeping the string manageable

If you do need Base64, reduce the image before encoding rather than after. Resize it to the dimensions it will actually display at, convert it to an efficient format, and compress it. Encoding a properly prepared 8 KB icon produces a string you can reasonably paste into a stylesheet; encoding a camera original does not.

As a rough guideline, inlining is defensible below about 10 KB and questionable above roughly 50 KB. Beyond that, serve a normal image file and let the browser cache it. Note that this tool encodes the bytes you give it exactly, including any EXIF metadata, so strip metadata first if the image carries location data you do not want embedded in source code.

Stay in the browser for the next step — convert, compress, crop, or strip metadata.

FAQ

Should I use Base64 in production pages?

Small icons can be inlined. Large photos bloat HTML. This tool is for encoding, not a recommendation to inline everything.

Frequently asked questions