Master Code
On The Go

Learn. Practice. Build.

Developer Tool

🔐 Base64 Encoder / Decoder

Encode text or files to Base64, or decode Base64 back to text. Supports URL-safe mode and full Unicode. Everything runs in your browser.

📁
Drop a file here or click to browse
📥 Input: 0 chars 📤 Output: 0 chars 📊 Change: —

🧠 How Base64 Works

  1. Every byte of data (text, image, file) is broken into 6-bit chunks.
  2. 6 bits = 64 possible values, mapped to A–Z, a–z, 0–9, +, and /.
  3. The encoded string is about 33% larger than the original because 3 bytes become 4 characters.
  4. Padding: if the input isn't a multiple of 3 bytes, one or two = signs are added at the end.
  5. URL-safe mode swaps + → - and / → _ so the string is safe in URLs and filenames.

Important: Base64 is encoding, not encryption. Anyone can decode it. Never use Base64 to protect passwords, tokens, or secrets. Use real encryption like AES instead.

💡 Common Uses for Base64

📧 Email attachments
MIME encodes files as Base64 to send through text-only email servers.
🎨 Inline images in CSS/HTML
Small images become data:image/png;base64,... to avoid extra requests.
🔑 API authentication
HTTP Basic Auth sends username:password as a Base64 string.
🪙 JSON Web Tokens (JWT)
JWT header and payload are Base64URL encoded JSON.
📦 Embedding data in JSON/XML
Binary data must be text-encoded to fit in JSON or XML.
🔗 Data URIs in URLs
Small files can be inlined as data: URLs without a server request.

❓ Frequently Asked Questions

What is Base64?

Base64 is a way of encoding binary data as text using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It lets you safely transmit binary data through systems that only handle text — like JSON, XML, email, or URLs.

Is Base64 encryption?

No. Base64 is encoding, not encryption. Anyone can decode it instantly. Never use Base64 to protect passwords, secrets, or sensitive data. Use real encryption like AES for that.

What is URL-safe Base64?

URL-safe Base64 replaces + with - and / with _, and drops padding equals signs. It's safe to use in URLs, filenames, and JSON Web Tokens. Standard Base64 uses + and / which need encoding in URLs.

Why does Base64 make data larger?

Base64 encodes 3 bytes of data into 4 characters, so it adds about 33% overhead. A 1 KB file becomes roughly 1.33 KB when Base64 encoded.

Does it support emoji and non-English text?

Yes. When UTF-8 mode is enabled (default), emoji, Chinese, Arabic, and any Unicode characters are encoded correctly.

Is my data uploaded to a server?

No. Everything runs locally in your browser. Your text or files never leave your device. No tracking, no ads.

❤️ Support Free Tools

This calculator is free forever. If it helped you, consider buying me a coffee.

☕ Buy Me a Coffee
← All Tools