Image to Base64

Convert an image into a Base64 data URL you can paste into CSS or HTML.

Your image is processed entirely in your browser. It is never uploaded to a server.

Advertisement

About this tool

PNG is lossless and supports transparency, which makes it the right choice for logos, screenshots and anything with sharp edges or flat colour. Files are larger than JPEG for photographs.

How to use it

  1. Choose an image, or drag one onto the box.
  2. The Base64 data URL appears below, ready to copy.
  3. Paste it into CSS, HTML or JSON wherever an inline image is wanted.

Base64 makes a file about a third larger, so it suits small images such as icons rather than photographs.

Frequently asked questions

Is my image uploaded anywhere?

No. The image is decoded and re-encoded entirely in your browser using a canvas. It never leaves your device, is never sent to a server, and nothing is stored.

Will the quality drop?

Converting to PNG, BMP or WebP lossless keeps every pixel. Converting to JPEG is lossy by definition, so the quality slider controls the trade-off between file size and fidelity.

Why did my photo come out the right way up?

Photographs from phones store an EXIF orientation tag rather than rotating the pixels. This tool reads that tag and applies the rotation, so the result matches what you saw in your gallery.

Is there a size limit?

Very large images are scaled to stay within the browser canvas limit — around 16.7 million pixels on iOS — because exceeding it silently produces a blank image. The aspect ratio is preserved when that happens.

Related image tools

Advertisement