Browser only - 100% private

Image to Base64 Converter

Convert an image to a base64 data URL, or decode a base64 string back to an image file. Useful for inline CSS, JSON payloads, and email signatures.

  • Instant results
  • Privacy-first
  • No signup

Image ↔ Base64

Encode an image as a base64 data URL, or paste base64 to download an image.

Upload an image to encode as base64.

JPG, PNG, WEBP, GIF, AVIF, SVG, and iPhone HEIC accepted. HEIC is decoded locally to JPG before encoding.

Image to Base64 online with ImgShifter

Drop an image and this tool encodes it to a base64 data URL you can paste straight into code - the bytes read with FileReader.readAsDataURL and come back as a string prefixed with data:image/png;base64,... A toggle strips or keeps that data: prefix: keep it for an HTML img src or a CSS background-image where the browser renders it directly, drop it when you're storing the raw string in JSON or a backend that stamps the MIME type itself. (Need to go the other way? The Base64 to Image tool decodes a string back to a file.)

Base64 inlining earns its keep on small assets - icons, a single-pixel placeholder, an SVG glyph - where skipping a separate HTTP request beats the roughly 33% size penalty the encoding adds. It's also the way to embed an image in a JSON API payload, an email signature that external image hosts would block, or a self-contained HTML export. Above ~10 KB, or for any image reused in several places, a real cached URL wins; inlined base64 can't be cached separately and duplicates the bytes everywhere it appears.

iPhone .heic files are decoded locally with a WebAssembly module first, then encoded to a data:image/jpeg base64 string that works in every browser and mail client - far more portable than raw HEIC bytes. Nothing uploads at any point: the encode is a local FileReader call. Confirm zero outbound traffic in the Network tab, or pull the network after the page loads.

Keep going

Other ImgShifter tools people use alongside Image to Base64.

Frequently asked questions

Short answers for image workflows, privacy, and supported formats.

What is a base64 data URL?

A base64 data URL is a way to embed binary data (like an image) directly inside text - HTML, CSS, JSON, or JavaScript. Instead of referencing an image with a URL, you encode the bytes as a base64 string prefixed with 'data:image/png;base64,' and inline the whole thing. Browsers, email clients, and most tools render the embedded image without making a separate network request.

When should I use base64-encoded images?

For very small images (under 2-3 KB) used in HTML or CSS where avoiding a separate HTTP request is worth it - icons, decorative graphics, single-pixel placeholders. For embedding images in JSON API payloads where a binary file can't be attached. For email signatures where external image hosts get blocked. For self-contained HTML files (offline docs, exports) where every asset must be inline.

When should I NOT use base64 images?

For large images (over ~10 KB). Base64 is roughly 33% larger than the original binary, can't be cached separately by the browser, blocks parallel downloads, and bloats your HTML/CSS file. Use a real URL or CDN. Also avoid base64 for any image used in multiple places - linking the same URL caches once; inlining base64 duplicates the bytes everywhere it appears.

What's the difference between including or excluding the data: prefix?

The data: prefix (data:image/png;base64,...) is required for HTML img src, CSS background-image, and anything the browser renders directly. For JSON payloads, custom storage, or APIs that handle the MIME type separately, the prefix is often stripped to keep just the raw base64 string. Toggle the switch on the tool to copy whichever form you need.

How big does the base64 string get?

Roughly 33% larger than the original file. A 12 KB PNG produces about a 16 KB base64 string. A 100 KB JPG becomes ~133 KB. For SVG, the increase is the same but SVGs are usually tiny to start with, so base64-encoding an SVG icon is one of the most common practical uses.

Is my image uploaded anywhere?

No. The encode runs via FileReader.readAsDataURL and the decode runs via the browser's Fetch API on a data URL - both operate entirely on your device. Open DevTools Network tab to confirm zero outbound traffic, or disconnect from the internet after the page loads.

Can I decode base64 back to an image file?

Yes. Toggle the tool to Decode mode, paste the base64 string (with or without the data: prefix), and download the resulting image. If the input is a full data URL, the file extension is taken from the MIME type; otherwise it falls back to .bin.

Can I base64-encode an iPhone HEIC photo?

Yes. Drop the .heic or .heif file - ImgShifter decodes it locally with a WebAssembly module first, then encodes the resulting JPG to base64. The data URL prefix becomes data:image/jpeg;base64,... which works in every browser and email client. Encoding the raw HEIC bytes would only work in HEIC-aware viewers (Safari, modern macOS), so the JPG round-trip is almost always what you want.