Image to Base64

Convert PNG, JPG, GIF, WebP, SVG and recognised images to Base64 Data URIs online. Keep original bytes, copy the result for HTML or CSS, or download the encoded text.

Encode
Input0 characters
Result

Your result will appear here.

How to convert an image to Base64

  1. Choose an image file or drag it into the input area.
  2. Keep line wrapping off for HTML and CSS; leave padding enabled for standard Base64.
  3. Encode the image, then copy the complete Data URI or download the text result.

Working with Image to Base64

A Data URI contains the media type and encoded image bytes. Encoding does not resize or recompress the image. Base64 adds roughly one third to the binary size, so ordinary image files are often better for large website images.

A one-pixel GIF as a Base64 Data URI

Input
pixel.gif (1 × 1 px, 42 B)
Result
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7

Questions about Image to Base64

How do I use the result in HTML or CSS?

Copy the complete data:image/…;base64,… value into an HTML img src attribute or CSS url("…"). The prefix identifies the image format; it is not part of the Base64 payload. This tool returns the URI, not an HTML or CSS wrapper.

Does encoding preserve transparency, animation and quality?

Yes. Encoding reads the original file bytes without resizing or recompressing them. PNG transparency, GIF animation and SVG markup remain in those bytes. Display still depends on the application that opens the result.

Which image formats and file sizes can I use?

The tool recognises PNG, JPEG, GIF, WebP, BMP, TIFF, AVIF and supported SVG documents from their contents. The limit is 32 MiB per file, one file at a time. For other formats, use File to Base64; encoding a file does not guarantee browser display support.

Is Base64 smaller, and will it work in email?

No. The encoded payload is about one third larger, plus the URI prefix. Small icons may suit inline use; larger images usually work better as separate files. Email clients and site security policies may block data: images, so test the destination before using them.

Are my files, tokens or text uploaded?

No. These tools process your input in your browser. The website serves the page and its code, but your input is not sent to a conversion server or saved in an account.

  • Base64 to Image

    Decode a Base64 image or Data URI, preview supported image types and download the original image bytes.

  • File to Base64

    Encode any file to a Base64 string, with optional Data URI prefix, padding and MIME line wrapping.

  • HTML Entity Encoder & Decoder

    Convert text and Unicode characters to HTML entities, or decode named and numeric HTML character references.

Explore all developer tools

Encoding & Files

Move between text, bytes, URLs and embedded images without changing your original data.

Data & Text Inspection

Read structured data, inspect tokens and understand exactly what changed.

Hashes, IDs & Schedules

Check file integrity, generate identifiers and make sense of times and recurring schedules.

Your input and files are processed on your device. Keep sensitive results out of shared clipboards and use a trusted device for private keys and tokens.