image-converters Your photos never leave your device

Image to Base64

Turn small images into Base64 code you can paste straight into HTML, CSS or JSON.

Drop your images here

or

Best for small icons and graphics under about 10 KB. You can also paste an image.

Settings

Output

Your code

Your Base64 code appears here.

    All image tools

    26 free tools, all private and in your browser

    How to convert an image to Base64

    1. 1Drop your images into the box above, or click Choose images.
    2. 2Choose a data URI, a CSS background or an HTML img tag.
    3. 3Click the copy button next to each image.

    What is a Base64 image?

    Base64 turns an image file into plain text. Put that text in a data URI, like data:image/png;base64,iVBOR..., and you can use it anywhere an image address goes, with no separate file to host.

    When to use it

    • Small icons and logos in HTML emails, where linked images are often blocked
    • Tiny images in CSS, to save an extra request
    • Images inside JSON, config files or single-file HTML pages

    When not to use it

    Base64 text is about a third larger than the original file, and browsers can't cache it separately from your page. For photos and anything over about 10 KB, a normal image file is usually faster. The tool warns you when an image is large.

    The output options

    • Data URI: the raw data: address, for anywhere that takes a URL.
    • CSS: a ready-made background-image rule.
    • HTML: a complete <img> tag with width and height filled in.