Turn PNG, JPG, WebP, SVG, GIF or BMP images into Base64 text you can paste straight into HTML, CSS, JSON or an email template.
No limits or paywall.
Use instantly, no account.
Processed inside your browser.
Clean, full-quality output.
No upload queue or waiting.
Works on phone and desktop.
Base64 turns an image into plain text, so it can live inside the HTML, CSS, JSON or email that uses it. No separate file, no broken image link, no extra HTTP request. It is how icons get embedded in stylesheets, images travel through JSON APIs and logos appear in HTML emails.
This free encoder converts PNG, JPG, WebP, SVG, GIF and BMP images to Base64 in your browser. Copy the result as raw Base64, a data URI, a ready-made HTML image tag or a CSS background rule, or download it as a text file. The image is never uploaded.
Before
photo.jpg (1600 × 1200)
34.7 KB
A JPEG file that has to be loaded as a separate request.
After
Base64 data URI
46.3 KB
The same bytes as text, ready to paste into an <img> tag or CSS.
Base64 always adds about one third to the size. Measured on a real JPEG; decoding the text gives back the original file byte for byte.
Drop a PNG, JPG, WebP, SVG, GIF or BMP image (up to 15 MB) into the encoder above. The file encoder is already open.
Choose raw Base64, a data URI, an HTML <img> tag or a CSS background-image rule.
Copy the text to the clipboard or download it as a .txt file, then paste it into your code.
| Output | Looks like | Use it in |
|---|---|---|
| Raw Base64 | iVBORw0KGgo… | JSON, APIs, databases |
| Data URI | data:image/png;base64,iVBOR… | src attributes, Markdown, JS |
| HTML | <img src="data:image/png;base64,…"> | Email templates, HTML pages |
| CSS | background-image: url("data:…") | Stylesheets, icons in CSS |
Images are binary data, and many formats (HTML attributes, CSS, JSON, email headers) only carry text safely. Base64 maps every 3 bytes of the file to 4 characters from a 64-character alphabet (A–Z, a–z, 0–9, + and /), with = padding at the end. The result is longer but survives anywhere text does.
The encoding is exact: no pixels are touched and no quality is lost. We encoded a real 34.7 KB JPEG, decoded the 46.3 KB of text, and got the identical file back.
The encoder offers four wrappers around the same data, so you can paste it directly where it belongs:
data:image/png;base64,…, usable wherever a URL is expected, such as src attributes, Markdown and JavaScript.<img> tag with the data URI, ready for email templates or a quick test page.background-image: url("data:…") rule for icons and patterns in stylesheets.Embedding saves a network request, which matters for tiny images on fast connections and for documents that must be self-contained. It hurts for larger images: the data grows by a third, it cannot be cached separately from the page or stylesheet, and the browser cannot start decoding it until the surrounding file arrives.
A data URI is only displayed if its type prefix is right. Browsers usually report the type of a selected file, but for some formats, such as HEIC and AVIF on Windows, they report nothing. In that case the encoder reads the first bytes of the file to identify it, so you still get data:image/avif;base64,… rather than an unusable application/octet-stream.
Files up to 15 MB can be encoded. Larger files produce text tens of megabytes long, which slows the page and is impractical to paste anywhere; compress or resize them first.
Below the encoder, the developer panel shows ready-to-copy snippets for JavaScript, Node.js, Python, PHP, Java, Go and more, with your own data filled in. Together with the HTML and CSS outputs, it is a quick way to check the exact syntax without leaving the page.
The file is read with the browser's FileReader and encoded on your device. Nothing is uploaded or logged. Once the page has loaded, encoding works even without an internet connection.
Each destination expects a slightly different form of the same data:
<img src="data:image/png;base64,…" alt="…">; always keep a meaningful alt text..icon { background-image: url("data:image/svg+xml;base64,…"); }.; some renderers (GitHub among them) do not display data URIs, so test first.Base64 makes binary data safe to transport as text; it does not hide it. Anyone can decode a Base64 image in seconds, for example with Base64 to Image. Do not use it to protect private images, and remember that an image embedded in a public page or email is as visible as any other image.
Base64 length is predictable: about 4 characters for every 3 bytes, plus the short data:image/…;base64, prefix. A 3 KB icon becomes about 4 KB of text, a 10 KB logo about 13.3 KB, and a 100 KB photo about 133 KB, which is already too long to paste comfortably into most code editors or CMS fields. That is the practical reason to keep embedded images small and to optimise them before encoding rather than after.
Embed a small logo so it shows even when external images are blocked.
Inline small icons in a stylesheet to avoid extra requests.
Send an image in a JSON field to an API that expects Base64.
Build self-contained HTML reports or Markdown notes with images inside.
Drop the image into the encoder above. The Base64 text appears immediately; pick raw Base64, a data URI, HTML or CSS, then copy it or download it as a text file.
Base64 represents every 3 bytes with 4 text characters, so it is always about 33% larger. Our 34.7 KB test JPEG became 46.3 KB of text. Gzip on a web server recovers part of that.
For small images, roughly under 10 KB: icons, tiny logos, placeholders, and images inside HTML emails or single-file documents. For large photos it is slower, because the image cannot be cached separately and makes the page larger.
No. Base64 is an exact text encoding of the file's bytes. Decoding it returns the original file byte for byte, which we verified.
No. The file is read and encoded by your browser. Nothing is sent to a server, so private screenshots and unreleased artwork stay on your device.
Raw Base64 is just the encoded text. A data URI adds a prefix with the file type, like data:image/png;base64,, so browsers know how to display it in src or CSS url().
PNG, JPG, WebP, SVG, GIF and BMP images, plus PDF, ZIP, JSON and text files. If your browser does not report a file's type (common for HEIC and AVIF on Windows), the encoder detects it from the file's bytes so the data URI is correct.
Use Base64 to Image: paste the text and download the original file.