curly{bits}

Free developer tools. Nothing leaves your browser.

curlybits / Base64

Base64 Encode & Decode

Convert text to Base64 and back instantly, with full support for emoji and every language. Encode a file or image as Base64 or a data URI, or decode Base64 into a file you can download. Nothing is uploaded.

Input
Output

How to use the Base64 Encode & Decode

  1. Choose Encode or Decode.
  2. Type or paste into the left box. The result updates as you type.
  3. To encode a file or image, click Encode a file… or drop it on the left box. Tick Output as data URI to use it in HTML or CSS.
  4. When decoding binary data, such as an image or PDF, you'll see a preview and a Download file button.

What is Base64?

Base64 is a way to write any data, including images and files, using only 64 safe characters: A–Z, a–z, 0–9, + and /, with = as padding. It's used wherever binary data has to travel through systems built for text: email attachments, JSON APIs, data URIs in HTML and CSS, and HTTP Basic authentication headers.

Hello, world!  →  SGVsbG8sIHdvcmxkIQ==

Base64 makes data about 33% larger: every 3 bytes become 4 characters.

Base64 is not encryption

Anyone can decode Base64 in a second. It hides nothing, so never use it to protect passwords or secrets. Use it only to transport data safely.

URL-safe Base64

Standard Base64 uses + and /, which have special meanings in URLs. The URL-safe variant (Base64URL) swaps them for - and _ and usually drops the = padding. JSON Web Tokens (JWTs) use it. The decoder here accepts both versions automatically.

UTF-8, emoji and other languages

The browser's built-in btoa() fails on characters like é, ไทย or emoji. This tool converts text to UTF-8 bytes first, so any language encodes and decodes correctly, matching what servers and programming languages produce.

Frequently asked questions

Is Base64 encoding secure?

No. Base64 is an encoding, not encryption. It can be reversed instantly by anyone.

Why does my Base64 end with = or ==?

The = signs are padding, added when the input length isn't a multiple of 3 bytes. They're optional in URL-safe Base64.

How do I convert an image to Base64?

Click <b>Encode a file…</b> and choose the image, then tick <b>Output as data URI</b>. Paste the result into an <code>&lt;img src="…"&gt;</code> or CSS <code>url(…)</code>.

How do I turn Base64 back into an image or PDF?

Switch to <b>Decode</b> and paste the Base64 (with or without the <code>data:</code> prefix). Images show a preview, and <b>Download file</b> saves it with the right extension.

Is my data uploaded?

No. Encoding and decoding happen in your browser. Nothing is sent to a server.

Add this Base64 encoder and decoder to your website

Free for blogs, schools and businesses. Copy the code below and paste it into your page's HTML. The tool works exactly like this one and runs in your visitors' browsers, so nothing is uploaded. Please keep the credit line so others can find it too.

Preview embed ↗