How to encode or decode Base64 online
- Paste plain text into the input field to encode it, or paste a Base64 string to decode it.
- Select Encode to Base64 or Decode Base64.
- Copy the result or download it as a text file. Use Reset to clear the input and result.
This tool handles text, including UTF-8 characters from different languages and emoji. It does not convert images or PDFs into downloadable binary files. The transformation runs in your browser and does not require an account.
Base64 examples you can try
| Plain text | Base64 |
|---|---|
| Hello | SGVsbG8= |
| Hello World | SGVsbG8gV29ybGQ= |
| café | Y2Fmw6k= |
| {"ok":true} | eyJvayI6dHJ1ZX0= |
Spaces and line breaks are part of the original text. Encoding Hello with a trailing newline produces SGVsbG8K, so an unexpected difference can come from an invisible character.
What Is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that translates raw bytes into a sequence of 64 printable ASCII characters (A-Z, a-z, 0-9, +, and /, with = reserved for padding). It is standardized by RFC 4648.
Base64 was engineered to transmit binary assets across communication channels that only reliably transport textual ASCII data—such as email (via MIME protocol), inline web fonts, data URIs in CSS, and JSON-based API payloads.
How Base64 Works Internally
Every group of 3 input bytes (24 bits) is partitioned into 4 groups of 6 bits each. Each 6-bit chunk maps to a decimal value from 0 to 63, which corresponds directly to a character in the Base64 alphabet table. Because 3 bytes become 4 characters, Base64 encoding introduces an approximate 33% increase in data size.
Proper Unicode (UTF-8) Handling
JavaScript's btoa() expects a string representing bytes and rejects characters whose values exceed 255. This tool first converts text to UTF-8 bytes with TextEncoder. When decoding, it uses TextDecoder in strict mode to report bytes that are not valid UTF-8 instead of displaying replacement characters.
Important Security Note: Encoding is Not Encryption
Base64 provides zero cryptographic confidentiality. It requires no secret key, password, or cipher to decode; anyone with access to the encoded string can reconstruct the original content within milliseconds. Never use Base64 to conceal passwords, API secrets, or personally identifiable information (PII).
Why does Base64 decoding fail?
- Incomplete input: copy the entire value, including any trailing
=padding supplied by the source. - A data URL prefix: this text decoder expects only the encoded part, not a prefix such as
data:text/plain;base64,. - A different alphabet: Base64url uses
-and_instead of+and/. This tool expects standard Base64. Use the JWT Decoder for a complete JSON Web Token. - Binary content: valid Base64 can represent an image, archive, or other non-text data. Such bytes may fail the UTF-8 check.
Frequently asked questions
Can I decode Base64 containing another language?
Yes, if the original bytes use UTF-8. Arabic, Chinese, accented Latin text, and emoji can all be encoded and decoded. Text stored in another encoding, such as Windows-1252, needs a decoder configured for that encoding.
Is Base64 the same as a hash?
No. Base64 preserves the original bytes in a reversible representation. A cryptographic hash such as SHA-256 produces a fixed-size fingerprint and cannot be decoded back into the original input.
Why does Base64 end with an equals sign?
Standard padded Base64 uses one or two = characters when the final input group contains fewer than three bytes. Some protocols omit padding; follow the requirements of the system receiving your value.
Reference: RFC 4648, Base64 and Base64url encoding.