code_blocks Base64 Encoder/Decoder

Encode and decode text and files to/from Base64 with URL-safe options

Quick Reference

SGVsbG8gV29ybGQ=
"Hello World" in Base64
+33%
Size increase (approx.)
A-Za-z0-9+/
Standard alphabet
A-Za-z0-9-_
URL-safe alphabet

About the Base64 Encoder/Decoder

Convert text and files to Base64 encoding instantly with our free online tool. Base64 is a binary-to-text encoding scheme that represents binary data using 64 ASCII characters. All encoding and decoding happens in your browser — your data never leaves your device.

What is Base64 Encoding?

Base64 is a group of binary-to-text encoding schemes that represent binary data in an ASCII string format. It's designed to carry data stored in binary formats across channels that only reliably support text content. The encoding uses a set of 64 characters: A-Z, a-z, 0-9, plus (+), and forward slash (/), with equals (=) used for padding.

Key Features

  • Text Encoding/Decoding — Convert plain text to Base64 and back instantly
  • File Support — Encode any file (images, documents, etc.) to Base64
  • URL-Safe Mode — Use the URL-safe alphabet (-_ instead of +/) for URLs and filenames
  • Data URI Generation — Generate complete data URIs for embedding in HTML/CSS
  • Image Preview — Decode and preview Base64 encoded images
  • Line Breaks Option — Add MIME-style line breaks for email compatibility

Common Use Cases

  • Email Attachments — MIME encoding for email attachments
  • Data URIs — Embed small images directly in HTML or CSS
  • API Data Transfer — Send binary data through JSON APIs
  • Storing Binary in Text — Store binary data in text-only databases or configs
  • Authentication — HTTP Basic Authentication uses Base64 encoding
  • JWT Tokens — JSON Web Tokens use Base64URL encoding

Standard vs URL-Safe Base64

Standard Base64 uses + and / characters, which have special meanings in URLs. URL-safe Base64 (Base64URL) replaces these with - and _ respectively, making the output safe for use in URLs, filenames, and other contexts where + and / might cause issues.

Size Considerations

Base64 encoding increases data size by approximately 33% (4 characters for every 3 bytes of data). While this overhead is acceptable for small files and data transfer, consider alternative approaches for large files where bandwidth is critical.

Privacy & Security

Base64 is an encoding, not encryption. It does not provide any security — anyone can decode Base64 data. Never use Base64 alone to protect sensitive information. All processing in this tool happens locally in your browser; your data is never sent to any server.