Image to Base64

Turn images (or any files) into Base64 text: a data: address for CSS, HTML or Markdown, many files at once.

The data entered in the form are processed only in your browser and will not be saved or sent anywhere.
Images (any file works too)

Drop files here, or paste a screenshot with Ctrl+V.

The files are read by this page on your device. Nothing is uploaded.

Image to Base64

Base64 writes any file as plain text, so it can live inside another text file: an icon inside a CSS file, a logo inside an HTML e-mail, a picture inside a JSON or a Markdown note. Drop the images (or any files), choose the form you need and press "Encode". Each file becomes one line, so a folder of icons turns into a ready list.

The "data: address" form is the most useful: data:image/png;base64, followed by the file, which works anywhere a link to an image does. The other forms wrap it for you: a CSS background-image line, an HTML <img> tag with the file name as its alt text, or a Markdown image. "Base64 only" gives the bare text for APIs and config files.

When it pays off. Base64 makes a file a third bigger, and a picture inside a CSS or HTML file cannot be cached on its own. For icons, small logos and tiny backgrounds it is a win: one request fewer, and the picture appears with the page. Above about 20 KB a separate file is usually faster, so the page warns you.

The type comes from the bytes. A PNG saved as .jpg still gets data:image/png, because the page reads the file's first bytes instead of trusting the name. That avoids images that work in one browser and not in another. The files are read on your device and nothing is uploaded.

Examples

  • A 2 KB SVG icon as a CSS background, so the stylesheet needs no extra request.
  • A company logo in an HTML e-mail signature, as an <img> tag ready to paste.
  • Ten small PNG icons as data: addresses for a JSON config, one per line.

Who it is for

Front-end developers, e-mail template makers, people writing documentation in Markdown, and anyone who needs a picture inside a text file. Nothing leaves your device, so internal graphics are safe to convert.