Base64 Image Encoder / Decoder Online

Convert images to Base64 Data URIs with ready HTML and CSS snippets, or decode them back, right in your browser.

The Base64 Image Encoder / Decoder runs entirely in your browser. Images you drop and Data URIs you paste are processed on your device and are never uploaded to ArrayKit.

Built and maintained by Udit Agarwal

Open the Base64 Encoder / Decoder

About Base64 Image Encoder / Decoder

The Base64 Image Encoder turns any image into a Base64 Data URI you can paste straight into HTML or CSS. Drop a PNG, JPEG, WebP, SVG or GIF and it instantly shows the Data URI plus production-ready snippets — an <img> tag with editable alt text and a CSS background-image rule — each with one-click copy. It also reports the MIME type, file size, pixel dimensions and string length, so you know exactly what you are embedding. Switch to decode mode to paste a Data URI, preview the image, and download it with the correct file extension. It is built for front-end developers, email and template authors, and anyone inlining small icons to save a request. Everything runs locally in your browser, so your images stay on your device.

Features

  • Drag and drop or click to encode PNG, JPEG, WebP, SVG and GIF into a Base64 Data URI
  • One-click copy of the raw Data URI, a ready HTML <img> tag, and a CSS background-image rule
  • Editable alt text that drops straight into the generated <img> snippet for accessibility
  • Shows the MIME type, file size, pixel dimensions and Data URI length at a glance
  • Decode mode pastes a Data URI to preview the image and download it with the right extension
  • Warns when an image is too large to inline efficiently as Base64
  • Handles SVG and GIF as well as raster photos, with sensible download file extensions
  • Runs entirely in your browser, so images are never uploaded to a server

How to use the Base64 Image Encoder / Decoder

  1. Keep the Image → Base64 tab selected and drop an image onto the drop zone
  2. Copy the Base64 Data URI, the HTML <img> tag, or the CSS background-image rule
  3. Optionally type alt text to bake it into the <img> snippet
  4. Switch to Base64 → Image, paste a Data URI, then preview and download the image

Example

Input

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAB…

Output

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAB…" alt="logo" />

A PNG becomes an inline <img> tag that loads with no extra network request.

Common errors & troubleshooting

  • Pasting a Data URI shows 'The Data URI payload is not valid Base64.' — Copy the whole string starting at data:image/… and including ';base64,', and remove any stray quotes or line breaks your editor wrapped in.
  • The decoded image will not preview. — Check that the MIME type matches the data — a PNG payload labelled image/jpeg will not render. Re-encode the original file to get a correct Data URI.
  • My HTML or CSS file ballooned after inlining an image. — Base64 adds about 33% overhead and inlined images are not cached separately. Inline only small icons and link larger images as normal files.
  • An SVG Data URI from another tool looks different. — Some tools percent-encode SVGs instead of Base64. This encoder always Base64-encodes; both are valid Data URIs but are not byte-for-byte interchangeable.

Frequently asked questions

What is a Base64 image Data URI?
A Data URI embeds an image directly inside a string like data:image/png;base64,XXXX. The image bytes are Base64-encoded, so you can drop the whole picture into an HTML src or CSS url() with no separate file or request.
Which image formats can I encode?
Any image your browser can read — PNG, JPEG, WebP, GIF, SVG, BMP, AVIF and ICO all work. The decoder reads the MIME type from the Data URI and offers a matching download extension.
Should I inline images as Base64?
Inlining suits small, frequently reused assets like icons or email images where avoiding a request helps. For larger images it usually hurts, because Base64 adds about a third to the size and the data cannot be cached on its own.
Can I decode a Data URI back to an image file?
Yes. Switch to Base64 → Image, paste the data:image/…;base64, string, and the tool previews the picture and lets you download it with the correct file extension.
Are my images uploaded when I encode them?
No. The encoder reads the file with the browser's FileReader and builds the Data URI on your device. Nothing is sent to ArrayKit or any server.
Why is the Base64 string bigger than my image?
Base64 represents three bytes with four characters, so the encoded text is roughly 33% larger than the original binary, plus the short data:…;base64, prefix. That overhead is normal and expected.

Related tools

Guides

More Images tools

  • App Icon Generator — Turn one image into every iOS, macOS and Android app icon size — downloaded as a ZIP, in your browser.
  • Sprite Sheet CSS Animation Generator — Turn a sprite sheet into a copy-paste CSS @keyframes animation using steps(), with a live preview.
  • SVG to PNG Converter — Convert SVG to PNG or JPG at any scale, with a transparent or solid background, in your browser.
  • Image Color Picker — Upload an image and pick colors from any pixel to get HEX, RGB and HSL values, in your browser.
  • Color Format Converter — Convert a color across HEX, RGB, HSL, HWB, LAB, LCH and OKLCH with a live swatch.
  • Barcode Generator — Generate EAN, UPC, Code 128 and Code 39 barcodes and download them as SVG or PNG.
  • Image Color Palette Extractor — Extract a dominant color palette from an image as HEX, RGB and HSL with CSS variables.
  • Flip & Rotate Image — Rotate by 90° and flip images horizontally or vertically, then download — in your browser.
  • Image Cropper — Crop an image to any area or fixed aspect ratio and download it, in your browser.
  • Image Watermark — Add a text or logo watermark to an image, anchored or tiled, with opacity and rotation.
  • Blur & Redact Image — Permanently blur, pixelate or black out parts of a screenshot before sharing it.
  • Round Image Corners — Clip photos to rounded rectangles or circles and export PNGs with transparent corners.

See all Images tools (40) · All tools