Image to Base64

Turn images into Base64 text you can paste straight into HTML, CSS, JSON or an API request, encoded on your own device.

Images are encoded in your browser and never uploaded. Free, no sign-up, no watermark.

Drop images here

JPG, PNG, WebP, HEIC, AVIF, GIF, BMP, TIFF, SVG · up to 20 files, 10 MB each

    Good to know

    Base64 text is about 33% larger than the image file. Inline only small icons and placeholders; link larger images as files.

    A data URI includes the type (data:image/png;base64,…) and works directly in src and url(). “Base64 only” is the bare string APIs and JSON usually expect.

    Photos still called IMG_4821.jpg?

    File Renamer AI names photos by what's in them, in bulk. 25 free renames.

    How to use it

    1. Drop one or more images onto the page or click Choose images.
    2. Pick the output: Data URI, Base64 only, CSS background, HTML img tag or Markdown.
    3. Click Copy, or download the text as a .txt file.

    About this tool

    Base64 represents binary data with 64 plain-text characters, so an image can live inside a text file. A data URI adds the type in front (data:image/png;base64,…) and works anywhere a URL does: an img src, a CSS url(), an email template. APIs and JSON payloads usually want the bare Base64 string instead.

    The catch is size. Base64 is about a third larger than the original file, and inlined images cannot be cached separately, so they are downloaded again with every page or stylesheet. Inline small things such as icons, tiny logos and loading placeholders under a few kilobytes; link anything larger as a normal file. Compressing the image first with Compress PNG or Compress JPG shrinks the Base64 too.

    Good to know

    • The data URI uses the real file type detected from the image bytes, not just the file extension.
    • Base64 output is about 33% larger than the image.
    • Up to 20 images at a time, 10 MB each.

    Other ways to do it

    Mac (Terminal)

    1. Open Terminal and run: base64 -i image.png -o image.txt
    2. The text file holds the Base64 on one line; add data:image/png;base64, in front for a data URI.

    Windows (PowerShell)

    1. Open PowerShell in the image folder and run: [Convert]::ToBase64String([IO.File]::ReadAllBytes("image.png")) | Set-Content image.txt
    2. certutil -encode also works, but it wraps lines and adds BEGIN and END CERTIFICATE lines you must delete.

    Private by design: nothing is uploaded

    Most online image tools upload your photos to a server and send back the result. This one does all the work inside your browser, so your images never leave your device. That makes it safe for personal photos, IDs, screenshots and client work.

    See all free image tools

    Frequently asked questions

    What is the difference between a data URI and Base64?

    Base64 is just the encoded data. A data URI is Base64 with a prefix that names the type, such as data:image/png;base64,. Browsers need the prefix in src and url(); most APIs want only the Base64 part.

    How do I use a Base64 image in HTML or CSS?

    Choose HTML img or CSS and copy the snippet. In HTML it goes in the src attribute of an img tag; in CSS it goes inside url() for background-image.

    Should I inline images as Base64?

    Only small ones. Inlining saves a request but adds about 33% to the size and prevents separate caching. Icons and placeholders under a few KB are good candidates; photos are not.

    Is my image uploaded to encode it?

    No. The browser reads the file and encodes it locally. Nothing is sent to a server.