SITE UNDER CONSTRUCTION. Everything here is provided AS IS, WITHOUT WARRANTIES, to the extent the law allows. It is information, not professional advice. Use at your own risk. Terms and liability limits →

eThorns ES
← ImagesES

Tool 3.8

Image to Base64 converter (data URL)

Turn an image into a Base64 data URL, plain Base64, an HTML <img> tag and a CSS background line, ready to paste. Runs in your browser; nothing is uploaded.

Runs on your deviceRuns entirely in your browser: nothing you type or upload leaves your device.

How to use it

  1. Drop an image, or click to choose it (up to 25 MB).
  2. Four boxes appear: the data URL, the Base64 alone, an HTML <img> tag and a CSS background line.
  3. Press Copy on the one you need and paste it into your code.

When an image has to travel as text

Base64 writes a file as plain letters and numbers, so it can go where only text fits. Typical cases: a small icon inside a CSS file, a logo in an HTML page or report that must be a single file, a photo sent to an API that expects a text field, or test data in a JSON file.

A data URL is that text with a short label in front saying what kind of file it is. Browsers can show it exactly like a normal image link, with no extra file to download.

Reading the result: a 4 KB logo

Drop logo.png, a 4 KB icon. The line under the preview says the file became about 5.4 KB of text: Base64 always adds roughly a third. The Data URL box starts with data:image/png;base64,iVBORw0KGgo, which is how every PNG begins. A JPEG starts with /9j/ and a GIF with R0lGOD, so the first characters tell you the real format even if the file name lies.

Copy the box you need. The HTML tag goes straight into a page, the CSS line into a style rule, and the Base64 only box is for APIs or JSON fields that ask for the raw text without the data: label.

When not to use it

Base64 is neither compression nor encryption: the text is bigger than the file, and anyone can turn it back into the image. Above 100 KB the tool shows a tip, because a large image inlined in a page slows it down more than a normal link would, and it can't be cached on its own.

The file is encoded exactly as it is, byte for byte: nothing is resized, compressed or cleaned. For shorter text, shrink the image first with the image resizer or the image compressor; the compressor also drops the photo's hidden data (EXIF).

FAQ

Why doesn't a Base64 image show in my email?

Many email programs don't display images written as data URLs, or remove them, so a Base64 logo in a signature can arrive as a broken image. For email, attach the image or link to a copy hosted on a website.

Can I encode an SVG?

Yes: drop it and the data URL starts with `data:image/svg+xml;base64,`. In CSS, an SVG can also go in a data URL as plain text with a few characters escaped, which is usually shorter than Base64; this tool only produces Base64.

Is there a size limit?

Files over 25 MB are refused, because four boxes of that much text would freeze the page. From 100 KB up the tool shows a tip: at that size a normal image file usually loads faster than inlined text.

Does the Base64 keep my photo's location?

Yes, if the photo had it. The tool encodes the file without changing it, so the EXIF data (GPS, camera, date) is inside the text. Strip it with the EXIF remover before encoding a photo you will publish.

How do I turn Base64 back into an image?

Paste the text in the Base64 tool on this site and press Decode to file. It accepts a full data URL or the Base64 alone, and names the file with the right extension when it can recognise the format.

  • 3.1HEIC to JPGConvert iPhone HEIC photos to JPG or PNG in your browser, several at once, with the JPG quality you choose.
  • 3.2Compress imagesShrink JPEG, PNG and WebP images by quality, dimensions or a maximum size in KB, several at once.
  • 3.3Remove EXIF & GPSSee and remove hidden photo metadata (GPS location, camera, date) before you share.
  • 3.4Resize imagesResize images by pixels or percentage, or change the aspect ratio (1:1, 4:5, 9:16…) by cropping or adding borders.
  • 3.5Convert imagesConvert images to PNG, JPG or WebP in your browser, several at once.
  • 3.6EPS to PNG or JPGTurn an EPS file, like a logo from a designer or print shop, into a PNG with a transparent background or a JPG at 150, 300 or 600 dpi.
  • 3.7SVG to PNGConvert SVG files to PNG with a transparent background, or to JPG.

╌╌ END ╌╌