Skip to content

Image to Base64 Converter

Encode an image as a Base64 data URI and copy it as HTML, CSS or JSON. The bytes are read and encoded in your browser.

Choose an image

The bytes are encoded in this tab. Nothing is uploaded.

Copy-ready output

The data URI and snippets appear here.

A data URI, an <img> tag, a CSS rule and a JSON object appear here.

The MIME type comes from the file the browser reported, with the extension as a fallback. An SVG converted this way stays an SVG document; it is not rasterised.

Your file is never sent to a server. It is read and processed by your own browser, and the results are not stored.

How to use it

  1. Choose an image or an SVG. The MIME type is read from the file.
  2. Copy the data URI, HTML tag, CSS rule or JSON field you need.
  3. Check the character count and overhead before pasting it into a page.

Limits worth knowing

  • Files up to 10 MB are read. Base64 is about a third larger, so a 10 MB photo becomes roughly 13 MB of text and is a poor candidate for inlining.
  • The encoder copies the file as it is. It does not optimise, resize or convert the image first.
  • The MIME type comes from the browser’s file type or the extension. A mislabelled file keeps its wrong label, so use the file inspector if the type matters.
  • Everything stays in the tab. There is no upload and no generated short link.

What a data URI actually is

A data URI packs the media type and the file bytes into one string: data:image/png;base64, followed by the encoded content. The browser decodes it exactly like a separate file, which is why it works in an img src, a CSS url() and a JSON field.

Base64 is not compression. It maps every three bytes to four printable characters, so the text is about 33% longer than the binary. The advantage is portability, not size.

Inline a file when it is small, used once, and the extra request costs more than the extra bytes — a 1 KB icon in a button, for example. Link it when it is a photograph, reused across pages, or large enough that separate caching and compression matter.

The tool reports the measured Base64 length for your file, so the decision is based on the real number rather than a rule of thumb.

Frequently asked questions

Does Image to Base64 Converter upload my files to any server?

No. Image to Base64 Converter runs in your browser, and the file is read there rather than sent to a server for processing. Our host still sees ordinary page-request metadata, which is described on the privacy page.

Is Image to Base64 Converter free to use?

Yes, Image to Base64 Converter is free, with no paid tier, no account, and no watermark added to your output. The limits are technical rather than commercial: file size, page count and supported formats are listed on this page.

What file formats and sizes are supported?

Image to Base64 Converter supports .jpg, .jpeg, .png, .webp, .svg, .gif files up to 10MB directly in your browser.

Does Base64 encoding upload the image anywhere?

No. The file is read with the browser File API and converted to text in the same tab. There is no server request in this tool, so the image never leaves your device.

How much larger does a Base64 string make an image?

About 33% larger than the raw bytes, plus the short data-URI prefix. The page shows the exact character count and the overhead for the file you chose instead of quoting a general rule.

When should I inline an image instead of linking it?

Inline data URIs are useful for tiny icons, email templates and single-file demos where an extra request is worse than the extra bytes. They are a poor choice for photos: the string is not cached separately, it bloats HTML and CSS, and it cannot be compressed as efficiently as a separate image file.

Inline or link?

Inline a file when it is small, used once, and the extra request costs more than the extra bytes — a 1 KB icon in a button, for example. Link it when it is a photograph, reused across pages, or large enough that separate caching and compression matter. The tool reports the measured Base64 length for your file, so the decision is based on the real number rather than a rule of thumb.