Image to Base64 Converter

Developer Tools

Drop an image and get its Base64 string, a data URI, and ready-to-paste HTML and CSS snippets.

Data URI

Read in your browser; the image is never uploaded. Only the file type, size and dimensions are saved to your past runs. Privacy

About

What the Image to Base64 Converter does

The Image to Base64 Converter reads an image on your device and writes it as Base64 text in four forms: the raw Base64 string, a complete data URI, an HTML <img> tag with its width and height, and a CSS background-image rule. The status line shows how much larger the text is than the file, and a warning appears when an image is too big to inline sensibly.

Steps

How to use it

  1. 1Drop an image on the page or choose a file.
  2. 2Pick the output: data URI, raw Base64, HTML or CSS.
  3. 3Copy it into your HTML, CSS, JSON or email template.

Example

A real run

Input

icon.png (16×16 PNG, 87 bytes)

Output

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAHklEQVR42mP4+vk/SYiBjhpyNW7iQaMaho+GQZP4AEAYU9uYjwmBAAAAAElFTkSuQmCC

An 87-byte icon becomes a data URI of about 140 characters: Base64 adds a third to the size, which is fine for an icon this small.

Options

Every setting, and when to use it

Data URI
data:image/png;base64,… is a complete URL you can put anywhere an image URL goes: src attributes, CSS url(), JSON fields.
Raw Base64
Only the encoded bytes, for APIs and config files that ask for Base64 without the data: prefix.
HTML and CSS snippets
An <img> tag with the image's real width and height, or a background-image declaration, so you can paste and go.

Good to know

Common problems and limits

Images up to 10 MB. Base64 text is about 33% larger than the file, and a warning appears above 10 KB of text.

Inlined images cannot be cached separately by the browser, so they suit small icons and placeholders, not photos. Shrink an image first with the Image Resizer.

To go back from text to an image, use Base64 to Image; for SVG, a URL-encoded data URI is usually smaller.

Audience

Who uses it

  • Front-end developersInline a small icon, logo or placeholder into CSS or HTML to save a request.
  • Backend and API developersEmbed an image in a JSON payload, a test fixture or an API request that expects Base64.
  • DesignersHand a developer a self-contained image snippet for a prototype or an HTML email mockup.

FAQ

Frequently asked

When should I inline an image as Base64?

For very small images, such as icons and tiny placeholders under a few kilobytes, where saving a request matters more than size. For anything larger, a normal image file is better: Base64 is a third bigger, cannot be cached on its own and delays the HTML or CSS it sits in.

What does a data URI look like?

data:[type];base64,[data], for example data:image/png;base64,iVBORw0KGgo…. The type tells the browser how to read the bytes; base64 says how they are written.

Should I use Base64 for SVG?

Usually not. SVG is text, so a URL-encoded data URI (data:image/svg+xml,%3Csvg…) is smaller than Base64 and still works in CSS and HTML.

Can I use Base64 images in email signatures?

Many email clients block or strip data-URI images, so a signature that looks right in one client can show a broken image in another. Hosted images, or attachments referenced by content ID, work more reliably.

How much bigger does Base64 make an image?

About 4/3 of the original, so a 30 KB PNG becomes about 40 KB of text. Gzip on the server recovers part of that, but the image still cannot be cached separately.

Is my image uploaded?

No. The image is read by your browser with FileReader and never sent anywhere. Only its type, size and dimensions are saved to your past runs.

Automation: an MCP tool image_to_base64(file) → data_uri and an n8n node are planned for this tool.

GuideEncoding vs hashing vs encryption, with examples →Encoding changes the format, hashing makes a fingerprint, encryption hides data behind a key. Worked examples with Base64, SHA-256, HMAC, TOTP and UUIDs.
Built and maintained by Radhika SinghLast updated Questions: hello@operativez.ai