FreeToolBoxImage tools

IMAGE ↔ BASE64 / DATA URL

Image to Base64, ready for your code.

Turn a small icon, PNG or photo into a Data URL, HTML, CSS or JSON string. Preview the result, or decode it back to the original image.

Files processed in your browserFree · no accountOriginal image bytes preserved

Choose an image, or try the sample

Drop an image here, or choose a file.

PNG, JPG, GIF, WebP, SVG, BMP, ICO · one file, up to 10 MiB

Three steps to usable code

  1. Choose or drop an image up to 10 MiB, or select “Try the sample”.
  2. Choose Data URL, pure Base64, HTML, CSS or JSON string. Check the image and encoded size.
  3. Copy the full result or download the text. Use “Decode this result” to check the round trip.

See a real input and output

The sample button loads this 16 × 16 transparent PNG through the same conversion path as your own file. Decoding and downloading should restore the original file bytes.

16 by 16 green and gold checker with transparent borderDownload sample PNG

Which output should I use?

Data URL
Includes the data:image/png;base64, prefix. Use it in an image src or CSS url().
Pure Base64
Encoded bytes only. Use it when an API expects the MIME type separately.
HTML / CSS
A copyable img tag or background-image declaration, not a complete webpage.
JSON string
A quoted Data URL string. Your API still determines the field name and payload structure.

When this helps, and when it does not

Useful for small icons, prototypes, test fixtures and self-contained pages. Base64 is not compression: its length is 4 × ceil(bytes ÷ 3), usually about one-third larger. Data URLs and code wrappers add more characters. Larger images usually work better as separate, cacheable files.

This tool does not resize, transcode or remove metadata, and animated files are not flattened. SVG content is preserved, not sanitized. Previews depend on browser format support and are limited to 40 MP and a maximum side of 10,000 pixels.

Email clients and website content policies may block Data URLs. Check the destination environment; this is not a universal solution for every email or website.

File bytes are processed in your browser, without an upload for conversion. The page still makes network requests for resources such as analytics scripts. Base64 is not encryption.