Skip to content
Free Image LabFree Image Lab

Loading…

    Image to Base64 Converter

    New

    Convert an image to base64 in your browser and copy it as a data URI, an HTML img tag, a CSS background or Markdown. The file is encoded exactly as it is, so it decodes back to the identical image.

    Drop an image here

    or paste with Ctrl+V. PNG, JPG, GIF, WebP, SVG and ICO.

    Runs entirely in your browser. Your images are never uploaded to a server.

    How it works

    1. Drop in an image, or paste one with Ctrl+V. PNG, JPG, GIF, WebP, SVG and ICO all work.
    2. Choose the form you need: a data URI, bare base64, an HTML img tag, a CSS background or Markdown.
    3. Copy it and paste it where it is going.

    Common use cases

    Frequently asked questions

    How do I convert an image to base64?
    Drop the image in and it is converted at once. Pick the format you want, such as a data URI to use as an image source, and press Copy. It runs in your browser, so the image is not uploaded anywhere.
    What is a data URI?
    A way of putting a file's contents directly where a link would normally go. It starts with data:, then the file type, then ;base64, and then the encoded file, for example data:image/png;base64,iVBOR and so on. A browser treats it exactly like a link to the image.
    Why is the base64 bigger than the image?
    Base64 uses four characters to carry every three bytes, so it is always about a third larger than the file. That is fine for small icons, where saving a separate download is worth it, and wasteful for photos. Over about 100 KB, a normal image file is usually the faster choice.
    Does converting to base64 change the image quality?
    No. The file's bytes are encoded exactly as they are, without being redrawn or recompressed, so decoding the base64 gives back the identical file. To check, paste it into the base64 to image converter.
    Can I convert an SVG to base64?
    Yes. SVGs are encoded like any other image, and the data URI is labeled image/svg+xml so browsers render it. For an SVG you could also URL-encode the text instead, which is often a little smaller, but base64 works everywhere.
    Is my image uploaded?
    No. The encoding happens in your browser, so the image never leaves your device.

    ← All convert tools