Skip to main content
Preparing workspace

Image to Base64

Convert an image to a Base64 data URL or export multiple PNG, JPEG, GIF and WebP images as JSON. Free browser-based converter with no file upload.

Still loading. If the tool doesn’t appear, reload this page.

About this tool

Image to Base64 Converter

Convert uploaded images into Base64 data URLs for quick embedding.

Image to Base64 turns a local image file into a complete data: URL — the `data:image/png;base64,…` string you can paste straight into an HTML `src`, a CSS `url()`, or a JSON field. It uses the browser's File API, calling `FileReader.readAsDataURL()` on the file you pick, which reads the raw bytes and encodes them with the standard Base64 alphabet (RFC 4648), every 3 bytes becoming 4 characters. There is no canvas redraw and no server round trip: the file never leaves your tab, and the preview you see is rendered from the generated string itself.

How to use Image to Base64

  1. Click the upload area and choose an image — PNG, JPG, WebP, GIF, SVG or any file your browser recognises as an image.

  2. Read the output panel: the Base64 data URL appears in the text area, alongside a live preview rendered from that exact string and the file's name, size and MIME type.

  3. Press Copy to place the full data: URL on your clipboard, or Download to save it as <filename>-base64.txt.

  4. For multiple raster images, open Batch JSON export, select the files and choose Download JSON or Copy JSON.

Why use Image to Base64

  • A complete data URL, not a bare string

    The output already carries the data:image/…;base64, prefix built from the file's own MIME type, so it works in src="" or CSS url() with nothing to prepend.

  • Byte-for-byte lossless

    readAsDataURL reads the original bytes with no canvas re-encode, so PNG transparency, GIF animation, SVG markup and the source format all survive intact.

  • The preview proves it decodes

    The image shown is rendered from the generated data URL itself — if it displays, the string is valid and pasteable.

  • Nothing is uploaded

    Reading, encoding, copying and downloading all happen in your browser. No account, no upload, and the page keeps working offline once loaded.

Common use cases

  • Inline a small icon or logo in a stylesheet as background-image: url("data:image/svg+xml;base64,…") to remove one HTTP request.
  • Drop a test image into a JSON body, a Postman request, or a unit-test fixture where an API expects a Base64 image field.
  • Export a JSON manifest of image data URLs and file metadata for test fixtures or a design handoff.
  • Ship a self-contained HTML report or offline documentation page with its images embedded, so nothing breaks when the file is moved.

Frequently asked questions

How do I convert an image to Base64?

Choose an image in the upload area. The full data URL appears when your browser finishes reading the file. From there, Copy puts the whole string on your clipboard and Download saves it as a plain-text file.

Link to answer
Is my image uploaded to a server?

No. The file is read inside your browser tab with the File API and encoded there; the page makes no network request with your image. That is also why the converter still works if you lose connectivity after the page has loaded.

Link to answer
How much bigger does Base64 make an image?

About 33% bigger — Base64 emits exactly 4 characters for every 3 bytes, so the encoded length is 4 × ceil(bytes / 3). A 30 KB PNG becomes roughly 40 KB of text, plus around 20-30 more characters for the data:image/png;base64, prefix. That overhead is why inlining is usually reserved for assets under about 10 KB.

Link to answer
What image formats does it accept?

Anything your browser reports as an image — the file input uses accept="image/*", which covers PNG, JPEG, WebP, GIF, SVG, AVIF, BMP and ICO. The MIME type is taken from the file itself and written into the data URL prefix; if the browser cannot determine one, the info panel shows "Unknown".

Link to answer
Does converting to Base64 reduce image quality?

No. Base64 is an encoding, not a compression step, and this tool never redraws the image on a canvas — it encodes the original bytes. Decode the string and you get a file identical to the one you started with, including animation frames and alpha transparency.

Link to answer
How do I use the Base64 string in HTML or CSS?

Paste the entire output, prefix included. In HTML that is <img src="data:image/png;base64,…" alt="">; in CSS it is background-image: url("data:image/png;base64,…"). Because the tool emits a full data URL rather than a raw payload, you do not need to add the data: header yourself.

Link to answer
Is there a file size limit?

The single-image converter accepts files up to 25 MiB and warns above 5 MiB. Base64 increases the byte size by about one-third, so use Download for a large result. Batch JSON export has a 10 MiB combined limit.

Link to answer
How do I convert multiple images to Base64?

Open Batch JSON export and choose up to 20 PNG, JPEG, GIF or WebP files, with a 10 MiB combined limit. The downloadable JSON lists each filename, MIME type, byte size and Base64 data URL in selection order. Conversion happens in your browser.

Link to answer