Skip to the converter

Image to Base64, without the upload.

Turn a picture into a Base64 string, a data URI, or a ready CSS rule, HTML tag or Markdown image. Or paste Base64 and get the picture back. Photos, scans and screenshots stay on your device.

  • Free, no sign-up
  • Data URI, CSS or HTML
  • Decode it back

How to turn an image into Base64

  1. Add your picture

    Choose it, drop it on the box or paste it.

  2. Pick the format

    Data URI, plain Base64, CSS, HTML or Markdown. The text changes at once.

  3. Copy or save it

    Copy the text, or save it as a .txt file.

What stays and what doesn't

The picture is only read. Nothing is changed or saved.

When it won't run

Two things stop a run before it writes anything, and each is said on the file's row. A file that cannot be read is reported as damaged, and a picture too large for this device says so, with the limit. In both cases nothing is changed and your original stays as it was. A file in a format the page does not take, such as a GIF, gets a sentence instead of a row.

Image to Base64: what to expect

The text is made from the bytes of your file exactly as they are. An animation stays animated, and the colour profile and camera details stay in the file, because nothing is drawn again. A data URI is the same text with the picture type in front, so it can sit directly in a style sheet or a page.

Base64 makes the text a third longer than the file. A data URI of more than a few dozen kilobytes starts to slow a page down, and past about a megabyte many editors and mail fields refuse it. The page tells you which side of those lines your picture falls on.

To go the other way, choose Base64 to image and paste the text. It reads a data URI, a CSS url(), an img tag, a plain Base64 string, the URL-safe kind and a string with lost padding or line breaks. The result is named by what the bytes really are, not by what the text claimed.

Questions

Are my pictures uploaded?

No. Your pictures are processed inside your browser, on your own phone or computer, and saved straight from this page. The reading at the top of the page counts every byte sent, and it stays at 0 B.

Is the picture sent anywhere?

No. It is turned into text on your device and nothing is uploaded.

What is a data URI?

A way to put a picture inside a page or a style sheet as text, so it needs no separate file. It starts with data: and the picture type, then the Base64 text.

Is Base64 a way to hide or protect a picture?

No. It is a way to write bytes as text. Anyone can turn it back into the picture, as this page does.

Why is the text longer than my file?

Base64 writes three bytes as four characters, so the text is a third longer.

Can I turn an SVG into text that is smaller?

Yes. For an SVG you can choose to keep it as readable text instead of Base64, which is shorter and still works in a data URI.

Other things to do with a picture