Base64 Encoder / Decoder – Encode Text Online
Encode and decode text to and from base64 with full Unicode support, URL-safe mode and one-click copy. Work with API payloads, tokens and data URLs.
Output length: 20 characters
Base64 is an encoding, not encryption — anyone can decode it. Don't use it to protect sensitive data.
How it works
Each 3 input bytes → 4 characters from the 64-character base64 alphabet, padded with '='.
Example: 'hello world' → 'aGVsbG8gd29ybGQ='.
Last updated: June 2026
How this calculator is verified
Checked by True Calculator automated test suite on
- Formula verified against a published worked example in the automated test suite
- Edge cases (zero, negative, boundary and unit-mismatch inputs) covered by unit tests
The full verification method is on our how we verify page. Found an error? Tell us and we will re-check it.
When to Use This Calculator
Developers in India encode and decode base64 constantly — embedding images in email, sending tokens through APIs, storing binary blobs and pasting encoded data into debuggers. This tool converts text to base64 and back, handling Unicode correctly, so Hindi and other Indian-language text survives round trips through its UTF-8 bytes. QA engineers use the decoder to inspect JWT tokens and API payloads during testing, and support staff decode URL-safe strings shared in tickets. Students learning networking and cryptography use it to see how Hello becomes SGVsbG8= and why padding appears. Because the encoder runs entirely in the browser, test payloads never leave the machine, which matters when debugging with sensitive sample data. Both directions in one tool make it the fastest check in a developer's workflow.
How to Use This Calculator
- Step 1: Paste or type the text you want to encode into the input box.
- Step 2: Choose encode to convert the text to base64, or switch on URL-safe mode for tokens that travel in URLs.
- Step 3: Copy the encoded output with the copy button for an API payload, token or data URL.
- Step 4: To go back, switch to decode, paste the base64 string — line breaks and URL-safe characters are handled automatically — and read the restored text.
Worked Example
Encode the word Man and the output is TWFu: the bytes 77, 97 and 110 become a 24-bit buffer split into four 6-bit groups, indexed to T, W, F and u. Shorter inputs gain padding: Ma becomes TWE= and M becomes TQ==, while hello encodes to aGVsbG8=. The same tool decodes tokens and payloads, including Hindi and emoji, because Unicode travels through UTF-8 bytes. URL-safe mode swaps + and / for - and _ and drops the padding, which is the form many web APIs expect.
Tips and Common Mistakes
- •Tip 1: Base64 is encoding, not encryption — anyone can decode it, so never put passwords or OTPs in a base64 string.
- •Tip 2: Use URL-safe mode when the encoded value appears in a URL, query string or filename, since + and / break those contexts.
- •Tip 3: Expect padding equals signs at the end when the input length is not a multiple of three bytes.
- ✗Mistake 1: Trying to base64-decode text that is not valid base64 — the tool flags invalid input instead of guessing, so paste the exact string.
- ✗Mistake 2: Assuming the output is human-readable; encoded text is meant for systems, and reading it directly is the usual source of confusion.
Frequently Asked Questions
What is base64 used for?
It encodes binary data as ASCII text for safe transport — embedding images in HTML or email, sending data in URLs, and API payloads.
Why does base64 output look like random characters?
Each 3 bytes of input becomes 4 characters from a 64-character alphabet (A–Z, a–z, 0–9, +, /), with '=' padding. The output is not encrypted, just encoded.
Is base64 the same as encryption?
No. Base64 is reversible encoding with no secret — anyone can decode it. Never use base64 to protect sensitive data.
How do I embed an image as base64 in HTML?
Use a data URI in an image tag, like img src with a data:image/png;base64 value, containing the encoded string. It saves a network request but makes the HTML larger.