Utilities

Base64 Encoder

Convert an image (or any small file) into a Base64-encoded string. Useful for embedding images directly in HTML, CSS, JSON or markdown without separate file references.

Drop your file here

or click to choose from your device

Supported: jpg · jpeg · png · webp · gif · txt · pdf · Max 10 MB

jpg · jpeg · png · webp · gif · txt · pdf · 10 MB max

Going deeper

Embedding images without separate files

Base64 encoding turns binary data — an image, a PDF, any file — into a long string of printable characters. That string can be embedded directly in HTML, CSS, JSON, or markdown, with no need to host the file separately. For tiny images (icons, logos, decorative UI elements), this is a popular technique to eliminate the HTTP request entirely.

The tradeoff is size. Base64 encoding expands data by ~33% because every 3 bytes of binary becomes 4 characters of text. A 30 KB image becomes a 40 KB string in your HTML file. The HTTP request saved is replaced by a larger HTML download, so it's not always a net win. For small images used once or twice, embedding is faster overall; for larger images or images used many times across a site, hosting the file is better.

Data URLs add a MIME-type prefix (data:image/png;base64,...) that lets the browser interpret the string directly as an image source. Use data URLs when embedding in HTML img tags, CSS background-image, or JSON-LD image fields. Use plain Base64 when you need just the encoded string — for example, when sending an image to an API that expects Base64 in the request body.

What you get

Features

  • Outputs plain Base64 or data URL

  • Optional line breaks for readability

  • Shows output size and original size

  • Files deleted immediately after processing

Step by step

How to use

  1. 1

    Upload an image or other small file.

  2. 2

    Choose plain Base64 or data URL format.

  3. 3

    Click Encode.

  4. 4

    Download the .txt file or copy to clipboard.

Your privacy

How this tool handles your file

Your file is processed in a per-request temp directory and deleted immediately afterwards. We never store or persist the encoded output.

Read more about our security practices or see our privacy policy.

Frequently asked

Common questions

Looking for something else? Browse all tools or ask us to build one.