🔐 Base64 Encoder & Decoder

Encode text & files to Base64 or decode Base64 back — with URL-safe mode, file downloads and an image-to-data-URI maker. 100% private, right in your browser.

or
Result will appear here…

📝 When do developers use Base64?

🔑 JWT & API tokens

JWT headers and payloads are Base64URL — paste a token to inspect its claims.

🖼️ Data URIs

Embed small images or fonts directly in HTML/CSS as data:image/png;base64,… to save HTTP requests.

📧 Email (MIME)

Attachments and headers in emails are Base64-encoded — decode one to see what's inside.

📦 JSON & APIs

Binary data (keys, files, certificates) travels safely inside JSON fields as Base64 text.

💻 Base64 in your code (cheat sheet)

Use these native one-liners instead of a website for repeated work:

JavaScript

// encode (UTF-8 safe)
btoa(unescape(encodeURIComponent('text')));
// decode
decodeURIComponent(escape(atob('dGV4dA==')));

Python

import base64
base64.b64encode('text'.encode()).decode()  # encode
base64.b64decode('dGV4dA==').decode()        # decode

PHP

base64_encode('text');   // encode
base64_decode('dGV4dA=='); // decode

Linux / macOS terminal

echo -n 'text' | base64        # encode
echo 'dGV4dA==' | base64 --decode # decode
Privacy first: everything runs locally with your browser's native encoding functions. Your data is never uploaded, stored or sent anywhere — safe even for tokens and production payloads. Remember: Base64 is not encryption — anyone can decode it.

❓ Frequently asked questions

Is Base64 encoding the same as encryption?

No. Base64 is an encoding, not encryption. It converts binary data into printable ASCII text so it survives text-only systems (email, JSON, URLs). Anyone can decode it with no key — never use it to hide passwords or secrets.

Is my data uploaded to a server?

No. Everything runs locally in your browser. Your text and files never leave your device — nothing is uploaded, stored or logged.

What is URL-safe Base64?

URL-safe Base64 (RFC 4648 §5) replaces + with - and / with _, and drops the = padding, so the output can sit inside URLs, filenames and OAuth state parameters without percent-encoding. Tick the URL-safe box to use it.

Why does Base64 output get ~33% bigger?

Base64 packs 3 bytes of input into 4 ASCII characters, so output is roughly 33% larger than the input. That's the trade-off for making binary data safe for text-only transport.

Can I convert an image to a Base64 data URI?

Yes. Upload any image with the file option, then click Image → data URI to get a data:image/…;base64,… string you can paste straight into HTML or CSS — perfect for small icons and logos.

Is this Base64 tool really free?

Yes — completely free, no sign-up, no limits and no watermarks. It works offline too, once the page has loaded.

🔗 See also

{ }

JSON Formatter

Beautify, minify & validate JSON — tree view, error finder, copy & download.

Format →
🔐

Password Generator

Create strong, random passwords with a strength meter — free and private.

Generate →
🔳

QR Code Generator

Turn any link or text into a scannable QR code instantly.

Create →
Share: