Skip to main content
FileForge

Image to Base64 Converter

Browser processing — files never leave your device

Encode an image as Base64 and copy it as a raw string, a data URI, an HTML <img> tag or a CSS background rule.

Loading tool…

How to use this tool

  1. Add an image (any common format).
  2. Choose the output flavor: raw Base64, data URI, HTML tag or CSS rule.
  3. Click Copy to put the result on your clipboard.
  4. Paste it into your code.

About this tool

Base64 encoding turns binary image data into text, letting you embed small images directly in HTML, CSS or JSON without a separate file request. The encoded text is about 33% larger than the binary file, so this technique suits icons and small graphics rather than photographs. The tool outputs the raw Base64, the full data URI with the correct MIME type, and copy-ready HTML and CSS snippets.

Frequently asked questions

When should I embed images as Base64?
For small assets (icons, tiny logos) where saving an HTTP request matters, or where external files aren't possible — emails, single-file HTML documents, JSON payloads. Large photos should stay as normal files.
Why is the Base64 output larger than my image file?
Base64 represents every 3 bytes of binary data as 4 text characters, adding roughly 33% overhead. That is inherent to the encoding.
Is my image sent to a server to encode it?
No. The FileReader API in your browser produces the Base64 string locally.