SuperDevTools

Image to Base64 converter

Nothing is sent to the server: the conversion runs in your browser.

Drop your images here

PNG, JPG, WebP, GIF, SVG and ICO. Up to 30 images at once, 10 MB max each. You can also paste an image (Ctrl + V).

Encoding options

Applies to PNG, JPG and WebP. SVG, GIF and ICO files are encoded as they are. If the shrunk version is heavier, the original is kept.

Results

No images yet.

    Turn an image into Base64 text

    This tool converts an image to Base64 and gives you a data URI you can paste straight into HTML, a stylesheet, an HTML email or a JSON file. It reads PNG, JPG, WebP, GIF, SVG and ICO, up to 30 images at once. The “Base64 → image” tab goes the other way: paste a data URI or raw Base64 and get the picture back as a file. Nothing is sent to the server: the conversion runs in your browser.

    If you need to encode plain text rather than a file, use the site's text Base64 encoder instead.

    How to use it

    1. On the “Image → Base64” tab, drop your files, click “Choose images” or paste a screenshot with Ctrl + V.
    2. Pick an “Output format”: “Data URI”, “Base64 only”, “HTML <img> tag”, “CSS background-image”, “Markdown” or “JSON”.
    3. For a heavy image, tick “Shrink the image before encoding” and set “Max width (px)” and “JPG/WebP quality”.
    4. For an SVG, tick “SVG: URL-encode instead of Base64 (often shorter)”.
    5. Click “Copy” under the image you want.

    To decode, open “Base64 → image”, paste your string and click “Show image”. The tool reports the type it detects from the file's first bytes (not from the data URI header), the dimensions and the size, then offers “Download file”.

    When a data URI makes sense, and when it doesn't

    A data URI puts the image inside the code itself, so the browser has no extra file to fetch. That works well for:

    • a small icon or bullet a few hundred bytes long in a stylesheet;
    • a logo in an HTML email signature that has to show up without an attachment;
    • a self-contained HTML page, prototype or report you send as a single file;
    • an image stored in a JSON field or a test fixture.

    Skip it for photos and anything over a few dozen kilobytes. Base64 text is a third bigger than the file, it is downloaded again with every page that embeds it, and the browser cannot cache it on its own. Above 20 KB once encoded, the tool shows a warning: a regular image file is the better choice.

    Working out the Base64 size

    Base64 writes every 3 bytes as 4 characters. For a file of n bytes the length is 4 × ⌈n / 3⌉ characters, where ⌈ ⌉ rounds up. A 1,000-byte PNG icon gives 4 × 334 = 1,336 characters, 33.6% more than the file, because the last group holds a single byte and is padded with ==. The data URI adds the data:image/png;base64, prefix (22 characters), for 1,358 characters in total. The tool shows these exact figures for each image.

    For SVG, URL encoding keeps the markup readable and only escapes awkward characters such as <, > and #. The result is often shorter than Base64, and the tool prints the exact size so you can compare.

    FAQ

    Are my images uploaded anywhere?

    No. Files are read and encoded by your browser. Only your settings (output format and options) are kept on your device for next time.

    Is the decoded image identical to the original?

    Yes, byte for byte, as long as shrinking is switched off. With shrinking on, the image is re-compressed: lighter, but no longer the same file. If the shrunk version comes out heavier, the tool keeps the original.

    Why is my Base64 rejected?

    The message names the character that is not allowed and its position, or reports an impossible length when the text was cut off while copying. Spaces and line breaks are ignored, and URL-safe Base64 (with - and _) is accepted.

    Does an animated GIF stay animated?

    Yes. GIF files, like SVG and ICO, are encoded as they are and never go through shrinking, so the animation survives in the data URI.