Image to Base64 Converter (and Base64 to Image)
Turn an image into a Base64 data URI for HTML or CSS, or a Base64 string back into an image.
or drag and drop here, or paste with Ctrl+V / ⌘V
Accepted: JPG, PNG, WebP, HEIC, SVG, AVIF, GIF, BMP, ICO, TIFF
This image is larger than 100 KB. Embedding big images in HTML or CSS makes pages slower; a normal image file is usually better.
Your images are processed in your browser and are not uploaded. Privacy details
How to use: Image to Base64
- 1 To encode, choose or drag in an image; the Base64 text appears straight away.
- 2 Pick how to copy it: data URI, Base64 only, an HTML img tag, CSS, Markdown or JSON.
- 3 Copy it to the clipboard or download it as a text file.
- 4 To decode, switch to “Base64 → Image”, paste the text and download the image.
About this tool
Base64 turns a file into plain text, so an image can be written directly into HTML, CSS, JSON or an email template instead of being loaded as a separate file. Developers use it for small icons, placeholders and logos that must always be available.
The encoder reads your file exactly as it is, without re-compressing it, and gives you ready-to-paste snippets. The decoder accepts plain Base64 or a full data URI (also URL-safe Base64), detects the real image format from the decoded bytes and lets you download the file.
Base64 text is about a third larger than the original file, so it is best for small images. Everything happens in your browser; nothing is uploaded.
Frequently asked questions
When should I use Base64 images?
For small images (icons, logos, placeholders under a few kilobytes) that should load together with the page or live inside a single file, such as an email template or a JSON payload. Large photos are better as normal image files, which browsers can cache and load in parallel.
Why is the Base64 text larger than the image?
Base64 uses 4 text characters for every 3 bytes, so it is about 33% larger. Compress or resize the image first if size matters.
What is a data URI?
A data URI is Base64 text with a prefix such as “data:image/png;base64,”. Browsers accept it anywhere an image URL is expected, for example in an img tag or a CSS background-image.
Which format will the decoded image have?
The format the data really contains (JPG, PNG, WebP, GIF, SVG, …). The tool detects it from the decoded bytes, not from the prefix you pasted.
Is my image uploaded?
No. Encoding and decoding happen in your own browser.
Related tools
-
SVG to PNG
Convert SVG files to PNG, one or many at a time.
-
Image Compressor
Make images smaller for email, websites and upload limits, and see exactly how much you save.
-
Favicon Generator
Make favicon.ico, Apple and Android icons and the HTML code from an image, letters or an emoji.
-
Image Converter
Convert any mix of images and PDFs: each file to JPG, PNG, WebP, AVIF, GIF, BMP, TIFF, ICO or PDF.