Image to Base64 Converter
Turn an image into Base64 you can paste straight into a web page, style sheet, email or document. Get a data URI, a complete HTML img tag, a CSS background or Markdown, and shrink or convert the image first to keep the code short.
or choose a source below
How to Convert an Image to Base64
Quick answer: drop your image in, pick Data URI, HTML, CSS or Markdown, optionally set a max width, then copy the code.
-
1
Add your image
PNG, JPG, GIF, WebP, SVG or ICO.
-
2
Pick the output
Data URI, HTML, CSS or Markdown.
-
3
Shrink if needed
Set a max width or change the format.
-
4
Copy the code
Paste it where you need it.
What You Get
Why Embed Images as Base64?
Embedding a small image as Base64 puts the picture inside your HTML, CSS or email itself, so it loads without a separate file. That is handy for email signatures and templates where linked images are blocked, for single-file web pages and reports, for small icons in style sheets, and for apps and documents that need everything in one file.
Output Formats
Data URI gives data:image/png;base64,… for use anywhere an image address is accepted. Base64 gives just the encoded text for web services and databases. HTML img gives a complete tag with the width, height and an alt text based on the file name. CSS gives a background-image line, and Markdown gives  for notes and documentation.
Keep It Small
Base64 adds about a third to the size, and large embedded images make pages and emails slow. Set a max width to scale the picture down before encoding, and choose JPG or WebP for photos to shrink them further. PNG keeps sharp edges and transparency for logos and icons. The summary shows the resulting character count.
Example
Your email signature tool blocks linked images. Drop your 600-pixel logo in, set the max width to 200, keep PNG, choose HTML img and copy the tag into the signature's HTML. The logo now appears everywhere, without relying on an outside link.
Who Uses Image to Base64?
Web developers embedding icons and small graphics, email designers building templates, writers creating single-file reports, app developers adding placeholder images, and anyone who needs an image inside a text-only format such as JSON.
Tips
Embed only small images, ideally under 20 to 50 KB; link larger ones as normal files. SVG icons can be embedded as they are, keeping them sharp at any size. To turn Base64 back into an image, use Base64 to Image, and to shrink images without encoding, try Compress Image or Resize Image.
Good to Know
Animated GIFs stay animated when kept in the same type without resizing; resizing or converting keeps only the first frame. JPG has no transparency, so transparent areas become white when converting to JPG. The original image is never changed or uploaded.
Everyday Scenarios
A newsletter editor embeds the company logo so it appears even when email programs block outside images. A developer adds a tiny loading spinner straight into a style sheet to avoid an extra request. A writer creates a single-file HTML report that includes its charts, so it can be emailed and opened anywhere. A note-taker pastes a Markdown image with the picture inside the note itself, so it never breaks when files are moved. In each case, shrinking the image first keeps the code short and the page fast.
Copy the result with one click and paste it straight into your code, template or note.
Private, Free and Unlimited
The image is encoded entirely on your device. There is no sign-up, no watermark and no daily limit. Files are processed by your own browser and never leave your device, which makes the tool safe for contracts, photos, ID scans, client work and anything confidential. Close the tab and everything is cleared from memory. It works in current versions of the major browsers on Windows, Mac, Linux and Chromebooks, and on iPhone and Android for smaller files.
Embedding Images as Base64: When It Helps and When It Hurts
Converting an image to Base64 produces a text string that can be placed straight into HTML, CSS or JSON as a data URL. The browser then needs no separate request to fetch the file.
Good uses
- Tiny icons and logos in CSS, where a separate request costs more than the data.
- Emails and single-file HTML pages that must work without external files.
- JSON APIs that accept images as text.
Costs
Base64 makes data about a third larger, and embedded images cannot be cached separately by the browser. For anything bigger than a few kilobytes, a normal image file is more efficient. Compress the picture first with the image compressor.
To reverse it, use Base64 to image.
Frequently Asked Questions
Questions about image to Base64