Encode text or files to Base64, decode Base64 strings — with URL-safe mode and data URI generation. Everything stays in your browser.

Plain Text
Base64 Output
Output will appear here...
Encode
Input: 0 B
Output: 0 B
Ratio:

How to Use This Tool

Step 1
Choose your mode
Select Encode to convert text to Base64, Decode to convert Base64 back to text, or File → Base64 to encode any file by drag and drop.
Step 2
Enter your input
Type or paste content into the input panel. The output updates instantly — no submit button needed.
Step 3
Configure options
Toggle URL-safe mode to use - and _ instead of + and /. In file mode, enable Data URI to get an embeddable data: string for HTML or CSS.
Step 4
Copy the result
Click Copy to grab the output. Use Swap to flip input and output for quick encode/decode roundtrips. The stats bar shows sizes and ratio.

Where Base64 Is Used

Base64 encoding appears across the entire web stack. Here's where you'll encounter it and why it matters.

Data URIs in HTML/CSS
Embed small images, fonts, or SVGs directly in your code with data:image/png;base64,... to eliminate extra HTTP requests.
JWT Tokens
JSON Web Tokens use Base64url encoding for the header and payload sections. The three dot-separated segments are each Base64url-encoded JSON.
Email (MIME)
Email attachments and non-ASCII email bodies are Base64-encoded per the MIME standard to survive transit through text-only mail servers.
API Authentication
HTTP Basic Auth sends credentials as Base64(username:password) in the Authorization header. Note: this is encoding, not encryption.
Binary in JSON/XML
JSON and XML are text formats that can't carry raw binary. Base64 lets you embed file uploads, images, or cryptographic keys in API payloads.
Source Maps
JavaScript and CSS source maps use Base64-encoded inline mappings via //# sourceMappingURL=data:application/json;base64,...

Frequently Asked Questions

What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters: A–Z, a–z, 0–9, +, and /. The = character is used for padding. It was designed to safely transmit binary data through systems that only handle text, like email protocols and JSON APIs. The name "Base64" comes from the 64-character alphabet it uses.
Why does Base64 make data about 33% larger?
Base64 encodes every 3 bytes of input into 4 ASCII characters. Each character represents 6 bits (2⁶ = 64 possible values), so 3 bytes × 8 bits = 24 bits of data become 4 characters × 6 bits = 24 bits of encoded data. The overhead comes from using 4 bytes to represent what was originally 3. That's a 4/3 ratio, or roughly 33% larger. If the input isn't a multiple of 3 bytes, = padding characters are added.
What is URL-safe Base64?
Standard Base64 uses + and /, which are reserved characters in URLs and file paths. URL-safe Base64 (defined in RFC 4648 §5) replaces + with - and / with _. This variant is used in JWTs, URL parameters, and filenames where standard Base64 would need additional percent-encoding to be safe.
Is Base64 encryption?
No. Base64 is encoding, not encryption. Anyone can decode a Base64 string without a key — it provides zero security. It's a common misconception that Base64-encoded API keys or passwords are "protected." They are merely reformatted. If you need to secure data, use actual encryption (AES, RSA, etc.) and treat Base64 as a transport encoding only.
Is my data sent to a server?
No. All encoding and decoding happens entirely in your browser using JavaScript. Your text and files never leave your device — nothing is transmitted, stored, or logged. You can verify this in the Network tab of your browser's developer tools.