Images & PDF · Step-by-step guide

How to Convert an Image to Base64 (Data URI)

Image to Base64 converts a picture into a long text string (a data URI) that you can paste straight into HTML, CSS or JSON, and turns such strings back into images.

Open the Image to Base64 Data URI Converter Free · No sign-up · 5 steps · 2 min read

How to use it

  1. Choose the direction

    Pick Image → Base64, or Base64 → Image to decode.

  2. Choose your image

    Press Choose an image and pick a file.

  3. Pick the output format

    Choose from Data URI, Raw Base64 only, CSS background-image, HTML <img> tag, Markdown image or JSON string.

    Image to Base64 converter with an image chosen and Data URI output selected
    Direction tabs (1), choose an image (2) and output format (3).
  4. Check the result

    The encoded text appears with a preview and size.

  5. Copy it

    Press Copy data URI or Copy CSS background and paste it into your code.

    Base64 data URI result with copy buttons
    The Base64 result (4) and copy buttons (5).

Tips and common questions

When should I use a data URI?

For small icons and images in emails, HTML files or CSS, where you want one file with no separate image. For large photos, a normal image file loads faster.

Why is the Base64 text bigger than the image?

Base64 makes data about a third larger. That is normal.

How do I turn Base64 back into an image?

Switch to Base64 → Image, paste the string, press Decode and then Download Image.

Privacy

Images are encoded in your browser and never uploaded.

Ready to try it? The Image to Base64 Data URI Converter is free and needs no account.

Open the Image to Base64 Data URI Converter

See all tool guides →