
Compress JPG, PNG and WebP images — or hit an exact target size in KB/MB.
Two-way, developer-friendly Base64 encoder/decoder with ready-to-paste snippets.
Your files never leave your device. Everything runs in your browser.
Image to Base64 converts a picture into a Base64 string that can be embedded directly in HTML, CSS, Markdown, JSON or code, and it also decodes Base64 text or data URIs back into an image file. It is the tool to reach for when you need a small icon inline in a stylesheet, or when an API expects an image as text.
The encoder supports JPG, PNG, WebP, GIF, SVG and BMP, works with multiple files, and offers ready-made output formats: a full data URI, raw Base64, a CSS rule, an HTML tag snippet, or Markdown image syntax. A size chip shows how much larger the text version is compared with the original file.
For decoding, paste a data URI or a snippet copied from code and the tool detects the format automatically, then lets you download the recovered image.
Base64 encodes every three bytes as four text characters, so the text is about 33% larger. That is fine for small icons and logos, but for large photos a normal file reference is almost always better.
Small, rarely changing assets such as icons, logos and tiny textures. Inlining them removes an extra HTTP request. Avoid it for photos and larger images, which bloat HTML or CSS and cannot be cached separately.
The preview is truncated for very long strings (over roughly 120,000 characters) so the page stays fast. The copy button and the downloaded .txt file always contain the complete string.
Yes. SVG images are converted like any other file. For SVG, consider whether inlining the markup directly would be cleaner, since the tool also has an SVG ↔ PNG converter and the Markdown Editor handles code as text.
Decoding expects a proper data URI or raw Base64 image data. Text that is not Base64, or Base64 that is not an image (for example an encoded PDF), is rejected. Remove surrounding code — for example the url() wrapper from CSS — before pasting.
Related image tools: Image Compressor, Image Converter, Image Resizer.
Encoding and decoding happen in your browser. Neither the image nor the Base64 text is sent anywhere.