Paste text or data, get your Base64 encode / decode result instantly
Flip between plain text and Base64 in one click — no sign-up, no waiting, nothing uploaded to a server. Everything runs right in your browser.
How to use it
- Choose Encode or Decode using the toggle above the input box.
- Paste your text (or a Base64 string) into the input field.
- The result appears instantly in the output box.
- Hit Copy to grab the result, or use the Data URI button if you need it wrapped for CSS or HTML.
Worked example
Say you want to encode the greeting Hello, World!.
Input: Hello, World!
Base64 output: SGVsbG8sIFdvcmxkIQ==
The two = signs at the end are padding — they keep the output length a clean multiple of 4 characters. To reverse it, switch to Decode, paste SGVsbG8sIFdvcmxkIQ==, and you get Hello, World! right back.
How to Base64 encode/decode in code
Python
import base64
# Encode
encoded = base64.b64encode(b'Hello, World!').decode('utf-8')
print(encoded) # SGVsbG8sIFdvcmxkIQ==
# Decode
decoded = base64.b64decode('SGVsbG8sIFdvcmxkIQ==').decode('utf-8')
print(decoded) # Hello, World!
JavaScript (browser & Node.js)
// Encode
const encoded = btoa('Hello, World!');
console.log(encoded); // SGVsbG8sIFdvcmxkIQ==
// Decode
const decoded = atob('SGVsbG8sIFdvcmxkIQ==');
console.log(decoded); // Hello, World!
// Note: btoa/atob handle ASCII only.
// For full UTF-8 support in Node.js:
const enc = Buffer.from('Hello, World!', 'utf8').toString('base64');
const dec = Buffer.from(enc, 'base64').toString('utf8');
How does Base64 work? (The quick version)
Base64 converts binary data into plain text using only 64 safe characters: A-Z, a-z, 0-9, +, and /. That set travels safely through any system that was built for text — email, URLs, JSON, CSS — without garbling.
Every 3 bytes of input become 4 Base64 characters. Here is how the word Man maps through the process:
| Character | M | a | n |
|---|---|---|---|
| ASCII (decimal) | 77 | 97 | 110 |
| Bits (8 each) | 01001101 | 01100001 | 01101110 |
| Regrouped as 6-bit chunks | 010011 | 010110 | 000101 | 101110 | ||
| Decimal value of each chunk | 19 | 22 | 5 | 46 | ||
| Base64 character | T | W | F | u | ||
So Man → TWFu. Three bytes in, four characters out — always that 4:3 ratio, which is why Base64 output is about 33% larger than the original.
Important: Base64 is an encoding, not encryption. Anyone can decode it immediately — it provides zero security. Never use it to hide passwords or sensitive data.
Standard vs URL-safe Base64
Standard Base64 uses + and /, which have special meanings in URLs. URL-safe Base64 (sometimes called Base64url) swaps those for - and _, so the string can sit inside a URL or a JWT token without percent-encoding. This tool supports both modes — just pick the one that matches your use case.
Data URI (for images and fonts in CSS/HTML)
A data URI wraps Base64 content with a media-type prefix so a browser can load it inline — no external file needed. The format looks like: data:image/png;base64,iVBORw0K.... Use the Data URI button in this tool to generate that prefix automatically.
When to use Base64 encoding
- Embedding small images, icons, or fonts directly into CSS or HTML.
- Sending binary data (like a file) inside a JSON payload or email attachment.
- Storing binary blobs in databases or environment variables that only accept text.
- Decoding a JWT (JSON Web Token) payload to inspect its claims.
- Working with APIs that return Base64-encoded responses (e.g. Google Vision, AWS Rekognition).
When not to use it
- For security or encryption — Base64 is trivially reversible by anyone.
- For large files — Base64 adds ~33% size overhead; use direct binary transfer or a CDN instead.
- For URL encoding of query strings — use percent-encoding (
encodeURIComponent) for that, not Base64.
Your data stays private
This tool runs entirely in your browser using JavaScript. Nothing you paste is ever sent to our servers. You can even disconnect from the internet and it will still work. That makes it safe to use with confidential tokens, credentials, or any private text.
For the full technical specification, see RFC 4648 — The Base16, Base32, and Base64 Data Encodings. The browser-native API (btoa / atob) is documented on MDN Web Docs.
Takeaway: Base64 encode and decode in seconds — paste your text or encoded string above and the result is already waiting for you.