SaafKit

Convert an image to a Base64 data URI

Turn a small image into text you can paste straight into CSS, HTML, an email template or a JSON payload, with no separate file to host.

  • Runs in your browser
  • Nothing uploaded
  • No account
  • No watermark
  • Free

How to image to Base64

  1. Drop in your image.
  2. Choose whether you want the bare data URI, a CSS rule or an img tag.
  3. Re-encode as WebP first if the original is large, which usually cuts the text considerably.
  4. Copy the result.

When this is a good idea

Base64 encoding turns binary into text, which lets an image live inside a stylesheet, an HTML file or a JSON field instead of as a separate file. The benefit is one fewer network request, and the ability to ship an image somewhere that can only carry text.

It is a good trade for a genuinely small image: an icon, a tiny logo, a one pixel gradient, an SVG. Those are cases where the request costs more than the bytes.

When it is a bad idea

Base64 makes a file about thirty three percent larger. That cost sits inside your HTML or CSS, which means it is downloaded before the page can render, it cannot be cached separately, and it cannot be lazy loaded. Inline a photograph and you have made your stylesheet enormous and your page slower, which is the opposite of what you were trying to do.

The rough rule: under about 2 KB, inlining usually wins. Over about 10 KB it usually loses. In between, measure.

Shrink it before you encode it

If you are going to inline an image, make it as small as possible first. The re-encode option here converts to WebP before encoding, which often halves the result. For anything with a flat colour or a simple shape, consider whether an SVG would do the job in a fraction of the characters, since SVG is already text.

Email is the exception

Inline images are tempting for email templates, but several major clients, Outlook among them, refuse to render Base64 images at all. For email, host the image and link to it.

Questions

What is a data URI?

A way of putting a file's contents directly into a URL, so that src or url() carries the image itself instead of pointing at a file somewhere.

Does Base64 make the image smaller?

No, it makes it about a third larger. What it saves is a network request, which is only worth it for very small files.

Can I use a Base64 image in an email?

Not reliably. Several major email clients refuse to render them. Host the image and link to it instead.

Is there a size limit?

Nothing technical here, but keep it small. Inlining anything over about 10 KB usually makes your page slower rather than faster.

The rest of the toolkit

Every one of these runs on your own device. Nothing is uploaded, and there is no counter anywhere.

Image tools

Remove a backgroundCut the background out of any photo and get a transparent PNG.Compress an imageDrop a photo in, slide the quality until the saving looks right, and download.Resize an imageSet a width and the height follows, or lock both to a size something else demands and choose whether the image fills the box or fits inside it.Convert a formatPick the format the next tool in your workflow expects.Crop an imageDrag across the image to choose the area you want.Circle cropMake a round profile picture with a genuinely transparent corner, so it sits properly on any background rather than showing a white square.Rotate or flipTurn a photo that came out sideways, straighten a horizon that is slightly off, or mirror an image so a subject faces the other way.Add a watermarkPut your name, studio or web address onto an image before you send a proof out.Images to PDFDrop in photos or scans and get one PDF with a page for each.Favicon generatorOne image in, a zip out with every size a browser asks for, the legacy ICO file, the Apple touch icon, a web manifest and the HTML to paste into your head.Palette from an imageGet the colours that actually dominate a photograph, ordered by how much of the image they cover, and copy any of them in the format you need.Image to Base64Turn a small image into text you can paste straight into CSS, HTML, an email template or a JSON payload, with no separate file to host.Passport photoChoose the country, frame your face in the box, and get a correctly sized photo at print resolution.Split an imageCut one picture into equal tiles.Add a borderPut a frame around an image.

Text and generators