Base64 Encoder & Decoder
Encode any text to Base64 or decode Base64 strings back to plain text. Supports standard and URL-safe modes. Runs entirely in your browser β nothing is ever sent to a server.
Enter text above to instantly encode it to Base64
How to Use the Base64 Encoder & Decoder
Select the Encode tab to convert plain text (including Unicode) into a Base64 string, or choose the Decode tab to reverse the process. Results update instantly as you type β no button click required.
Step-by-Step Guide
1. Choose Encode or Decode
Click the tab that matches your goal. The Encode tab converts readable text to Base64; the Decode tab reverses it.
2. Enable URL-safe if Needed
If the output will be used inside a URL, query string, or filename, toggle URL-safe Base64 to replace '+' and '/' with '-' and '_'.
3. Type or Paste Your Input
Enter text or a Base64 string in the top textarea. The encoded or decoded result appears instantly in the output box below.
4. Copy or Swap
Click 'Copy Output' to copy the result to your clipboard. Use the Swap button to push the output back as the next input β handy for round-trip verification.
Common Use Cases for Base64
| Use Case | Why Base64? |
|---|---|
| Data URIs (inline images) | Embeds binary image data directly in HTML/CSS without a separate HTTP request |
| HTTP Basic Authentication | Credentials (user:pass) are Base64-encoded in the Authorization header |
| JWT tokens | Header and payload sections are URL-safe Base64url-encoded JSON objects |
| Email attachments (MIME) | Binary attachments are Base64-encoded so they survive text-only transport |
| API payloads | Binary or structured data transmitted safely inside JSON strings |
| Environment variables | Secrets or certificates encoded for safe storage in .env files |
Base64 vs URL-safe Base64: Which Should You Use?
Standard Base64 uses +, /, and = characters that can break URL parsing. Use URL-safe Base64 (Base64url) whenever the output will appear in:
- URL query parameters or path segments
- HTTP cookie values
- JWT token strings
- Filenames on any operating system
For everything else β email, data URIs, general data storage β standard Base64 is the correct choice.
Important Security Note
Base64 is an encodingscheme, not encryption. Anyone who receives a Base64 string can decode it immediately without a key or password. Never use Base64 to βhideβ sensitive information. For secure transmission, always combine Base64 with proper encryption (TLS/HTTPS, AES, etc.).
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, +, /). It is commonly used to encode data in HTTP headers, data URIs, email attachments (MIME), and JSON payloads where binary data would otherwise cause parsing issues.
What is the difference between Base64 and URL-safe Base64?
Standard Base64 uses '+' and '/' characters which have special meanings in URLs. URL-safe Base64 (also called Base64url) replaces '+' with '-' and '/' with '_', and typically omits the '=' padding characters. This makes the encoded string safe to include in URLs and filenames without percent-encoding.
Does this tool send my data to a server?
No. All encoding and decoding happens entirely inside your browser using the built-in btoa() and atob() JavaScript APIs. Your text or Base64 data is never transmitted to any server. You can even use this tool offline after the page has loaded.
Can I encode non-ASCII (Unicode) text?
Yes. This tool handles Unicode correctly by using encodeURIComponent() before encoding, which converts multi-byte characters to their UTF-8 percent-encoded form first. This ensures that characters like Chinese, Arabic, emoji, or accented Latin letters are encoded and decoded accurately.
Why does my decoded output show gibberish or an error?
If decoding produces an error, the input string is not valid Base64. Common causes include: missing or extra padding ('=' characters), illegal characters in the string, or using standard Base64 when the string is URL-safe Base64 (or vice versa). Toggle the URL-safe option and try again. If the output looks like gibberish, the original data may have been binary (e.g. an image) rather than text.
Related Tools
Need a Full Technical SEO Audit?
Our SEO experts can audit your site's technical health β crawlability, performance, structured data, and more β and deliver a custom action plan.
Get a Free SEO Audit