Sign up free

Image to Base64 Converter

Encode pictures as Base64 on your device and copy them in the format your code needs.

or drop files here

Accepts JPG, PNG, WEBP, GIF, SVG, ICO

Runs in your browser. Your files never leave your device.

About Image to Base64

Convert an image to Base64 when you want it inside your code instead of as a separate file: a small icon in a CSS file, a logo in an HTML email template, an image in a single-file demo, or a picture in a JSON payload for an API. Pick one or several images and the encoded text appears right away.

Switch Copy as between Data URI, plain Base64, a CSS background-image rule, a ready img tag or Markdown, then copy with one click. Base64 text is about a third larger than the file, and the page shows both sizes, so it's best for small images. Everything is done by your browser, nothing is uploaded, and each image can be up to 20 MB.

How to use Image to Base64

  1. 1
    Choose your images

    Click Choose images or drop the files you want to turn from image to Base64. PNG, JPG, WebP, GIF, SVG and ICO all work.

  2. 2
    Pick the output format

    Under Copy as, choose Data URI, Base64, CSS, img or Markdown.

  3. 3
    Copy the code

    Click Copy next to an image and paste the text into your HTML, CSS or JSON.

Why use Cubfile for this

  • Five output styles

    Data URI, raw Base64, a CSS background, an HTML img tag and a Markdown image.

  • Size shown up front

    Each file shows its original size next to the encoded size.

  • Several images at once

    Encode a whole icon set in one go, each with its own copy button.

  • Never uploaded

    Encoding happens in your browser and doesn't use any daily tasks.

FAQ

Image to Base64: questions and answers

When should I convert an image to Base64?
For small images such as icons, logos in email templates or single-file pages. Large photos are better as normal files, since Base64 adds about a third to the size and can't be cached separately. Shrinking the image first with Compress Image keeps the encoded text shorter.
What's the difference between a data URI and plain Base64?
A data URI starts with the image type, like data:image/png;base64, and goes straight into src or url(). Plain Base64 is only the encoded characters, for APIs and JSON fields that expect raw data.
Is there a size limit for image to Base64?
Each image can be up to 20 MB. In practice, keep embedded images small, since anything over a few hundred KB makes pages and emails heavy. Reducing its pixel size with Resize Image helps keep it small.
Are my images uploaded when I convert them to Base64?
No. Your browser reads and encodes them locally, so they never leave your device.
Is the image to Base64 converter free?
Yes, without limits. Browser tools don't count toward the daily tasks, and no account is needed.
Share Image to Base64 with a friendIt runs in any browser, and they can try it without signing up.

Related tools

IMG Compress ImageShrink JPG, PNG, WebP and GIF with no visible loss, in bulk.
QR QR Code GeneratorMake QR codes for links, text, Wi-Fi and contacts, with your logo and colours.
IMG Resize ImageResize by pixels, percentage or social media preset, in bulk.
KBIMG Compress Image to KBHit an exact size like 20 KB, 50 KB or 100 KB for upload forms.
IMG Crop ImageCrop freely or to 1:1, 4:3, 16:9 and more. Animations stay animated.
GIF GIF MakerTurn images into an animated GIF, WebP or APNG with your timing.
😆IMG Meme GeneratorAdd captions and emoji to a picture or GIF and save the meme or sticker.
IMG Stitch ImagesJoin screenshots vertically or side by side into one image.