Convert an image to Base64

Get a data URI, Base64 string, HTML img tag or CSS rule for any image.

or drop them here · paste with Ctrl+V

What it does

Embed small images straight into HTML, CSS, JSON or email templates without hosting a file. Drop one or more images and each is read as Base64 in your browser, then shown in the format you pick: a full data URI, the raw Base64 string, a ready-made <img> tag or a CSS background-image rule. Copy it with one click or download it as a .txt file. The file’s bytes are encoded exactly as they are, with no re-compression. Very long strings are shortened on screen to keep the page responsive, but Copy and Download always include the whole text. Files up to 10 MB are accepted, and images over 50 KB get a warning, because at that size a normal image file usually loads faster.

How to use it

How it works
  1. Click “Choose images”, drop one or more images onto the box, or paste with Ctrl+V (⌘+V on a Mac).
  2. Pick “Data URI”, “Base64” (the raw string), “HTML” (an <img> tag) or “CSS” (a background rule).
  3. Click “Copy” to put it on your clipboard, or “Download .txt” to save it.

Common uses

  • Embedding small icons and logos directly in HTML or CSS
  • Storing images inside JSON, configuration files or test fixtures
  • Quick placeholders in prototypes without hosting an image

Tips

  • Optimize SVGs or compress PNGs first: every byte you save removes about 1.33 characters of Base64.
  • Keep large images as normal files. Browsers cache them separately, which Base64 can’t do.

Questions

Why is the Base64 text bigger than my image?

Base64 uses 4 characters for every 3 bytes, so the text is about 33% larger than the original file.

When should I use Base64 images?

For small icons, logos and placeholders, usually under 10 KB, where saving a network request matters. Larger images load faster as normal files because browsers can cache them.

Does it work with SVG and GIF?

Yes. SVG, PNG, JPG, WebP and GIF all work, and the data URI keeps the original file type.

Behind this tool

Related tools

  • Compress images

    Compress JPG, PNG and WebP images to 200 KB or less each, keeping their format. Batch compress in your browser and download a ZIP.

  • Convert HEIC to JPG

    Convert iPhone HEIC photos to JPG in your browser, one at a time or a whole batch with a ZIP download. Nothing is uploaded.

  • Resize images

    Resize JPG, PNG and WebP images to exact pixel dimensions or by percentage. Keep the aspect ratio, resize in bulk, no upload.

  • Passport & ID photo maker

    Make a passport or ID photo at the right size for the US, UK, Canada and more, plus a 4×6 inch print sheet. Free, private, no upload.

  • Convert images to PDF

    Combine JPG, PNG and other images into one PDF in your browser. Reorder pages, pick A4 or Letter, no upload and no watermark.

  • Crop an image

    Crop photos in your browser: free-form, square for profile pictures, or a circle with a transparent background. No upload, no watermark.