Output appears here
About Base64 Encode / Decode
The Base64 Encoder / Decoder converts text to Base64 encoding or decodes Base64 strings back to plain text instantly. Supports standard Base64 and URL-safe Base64 (replacing + with - and / with _). Handles Unicode text correctly using UTF-8 encoding.
Base64 is used to encode binary data as ASCII text for safe transmission in email (MIME), embedding images in HTML or CSS data URIs, encoding credentials in HTTP Basic Auth headers, storing binary data in JSON or XML, and passing data in URLs.
Everything runs entirely in your browser using the atob() and btoa() Web APIs. Your data never leaves your device.
Base64 Encode / Decode Features
- Text and file encoding in one tool
Paste text directly, or switch to file mode to Base64-encode images, PDFs, or any binary file for embedding in JSON, CSS, or HTML.
- URL-safe variant included
Toggle URL-safe Base64 (using - and _ instead of + and /) for encoding data that needs to go in a URL or filename without further escaping.
- Handles malformed input gracefully
Decoding invalid Base64 shows a clear error instead of silently producing garbage output, so you know immediately if the input was corrupted or truncated.
How to Use Base64 Encode / Decode
Paste your text or Base64 string into the input.
Select Encode (text → Base64) or Decode (Base64 → text).
Optionally enable URL-safe mode for use in URLs.
Copy the result.
Examples
Practical Uses for Base64 Encode / Decode
- Embed a small image directly in HTML or CSS using a data URI
- Encode credentials for an HTTP Basic Auth header
- Decode a Base64 string found in an API response or JWT
- Encode binary file data for safe storage in a JSON field
- Generate a Base64 attachment payload for a MIME email
- Decode a Base64-encoded environment variable or secret
Common Mistakes to Avoid
- Assuming Base64 hides or protects the data.
- Treat Base64 as a text-safe transport format only. Anyone can decode it instantly — encrypt first if the content needs to stay private.
- Using standard Base64 output directly in a URL.
- Standard Base64's + and / characters have special meaning in URLs. Use the URL-safe variant (- and _) when the encoded string will appear in a URL or filename.
- Forgetting that Base64 output is about 33% larger than the input.
- Three bytes of binary become four Base64 characters. Budget for that overhead when embedding encoded files in JSON payloads or data URIs.
Who Uses the Base64 Encode / Decode Tool
- Developers encode and decode API payloads, auth headers, and data URIs during debugging.
- Backend engineers inspect Base64-encoded fields in JWTs, config files, and message queues.
- DevOps and SREs decode Base64-encoded Kubernetes secrets and environment variables.
- QA engineers verify that binary attachments or images are correctly encoded in API responses.
- Students learn how binary-to-text encoding works for a computer science or networking course.
Comparisons
Base64 vs URL Encoding
Base64 and URL encoding solve different problems. Base64 converts arbitrary binary data into a compact ASCII representation, used for embedding images, encoding auth headers, and storing binary data in text formats.
URL encoding (percent-encoding) instead makes text safe to appear inside a URL by escaping characters like spaces and & that would otherwise break the URL's structure. They're sometimes combined: a Base64 string can itself need URL encoding if it contains + or / and is placed in a URL, which is exactly why Base64's URL-safe variant exists.
Base64 vs Encryption
Base64 is often mistaken for encryption, but it provides no security at all. It is a public, reversible encoding scheme — anyone can decode a Base64 string instantly with no key required.
Encryption transforms data using a secret key so that only someone with that key can recover the original content. If you need to protect sensitive data, use a real encryption algorithm like AES; use Base64 only when you need to represent binary data as text, not when you need to hide it.
Frequently Asked Questions
What is Base64 used for?
Base64 encodes binary or arbitrary data as printable ASCII text for safe transmission in systems that only handle text, such as email (MIME), HTTP headers, JSON, XML, and URLs.
Does it support URL-safe Base64?
Yes — URL-safe mode replaces + with - and / with _ so the output can be safely included in URLs and filenames without percent-encoding.
Does it handle Unicode and emoji?
Yes — text is encoded as UTF-8 before Base64 encoding, ensuring all Unicode characters including emoji are handled correctly.
Is Base64 encryption?
No — Base64 is encoding, not encryption. It does not provide any security. Anyone who sees a Base64 string can decode it instantly.
How do I embed an image in HTML using Base64?
Encode the image file as Base64, then use it as: <img src="data:image/png;base64,ENCODED_DATA_HERE">
Why is Base64 encoded data about 33% larger than the original?
Base64 represents every 3 bytes of data as 4 ASCII characters (4/3 ratio). This overhead is the trade-off for making binary data safe to transmit as text.
Can I use this to decode a Kubernetes secret?
Yes — Kubernetes stores secret values as Base64-encoded strings in manifests and 'kubectl get secret -o yaml' output. Paste the encoded value here to decode it back to plain text.
Why does my Base64 string end with = or ==?
The = characters are padding, added when the input length isn't a multiple of 3 bytes. Padding ensures the encoded output length is always a multiple of 4 characters, which some decoders require.
Can I encode a file, not just text?
This tool encodes and decodes text input. For encoding actual binary files (images, PDFs), that's typically done in code, though the resulting Base64 string can be decoded back here if it represents text-based content.
Related Tools
Ready to use Base64 Encode / Decode?
It's free, runs entirely in your browser, and there's nothing to install or sign up for.
Scroll up & try it now ↑