Encode text to Base64 and decode it back — UTF-8 safe, free, private.
What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents arbitrary bytes using a set of 64
printable ASCII characters (A–Z, a–z, 0–9, + and /, with = for padding). It is used everywhere
data must travel through text-only channels: email attachments (MIME), data URIs in HTML and CSS,
JSON Web Tokens, API keys, and basic HTTP authentication headers. Encoding grows the data by
about 33%, because every 3 bytes become 4 characters.
How to use this tool
- Type or paste text into the Plain text box — the Base64 result appears instantly as you type.
- Or paste Base64 into the Base64 box to decode it back to text live.
- Enable URL-safe to replace + and / with - and _ and strip the = padding.
- Use Swap to move the output back into the input, and Copy output to grab the result.
Base64 is not encryption
Base64 provides no security whatsoever. It is a reversible encoding with a
public, trivially decoded alphabet — anyone can turn Base64 back into the original data in a
fraction of a second, without any key. Never use Base64 to hide passwords, tokens, or secrets.
If you need confidentiality, use real encryption (for example AES); if you need to store
passwords, use a password hashing function such as bcrypt or Argon2.
Common decoding mistakes (and fixes)
When decoding fails, the status line names the reason, and each one has a different fix:
- Characters outside the Base64 alphabet usually means you pasted a data URI such as
data:text/plain;base64,aGk=. Only the part after the comma is Base64; remove the prefix and decode again.
- Length is invalid means the character count leaves remainder 1 when divided by 4, which genuine Base64 can never produce. The paste was truncated, so copy the complete value again.
- Not valid UTF-8 means the Base64 encodes binary data (an image, PDF, or archive), not text. This converter handles text only.
Three things look wrong but decode fine here: line breaks (MIME wraps Base64 every 76 characters), missing = padding, and URL-safe - and _ characters. The decoder normalizes all three automatically, so the URL-safe toggle is not needed when decoding.
Padding and length reference
Standard Base64 turns every 3 bytes into 4 characters. Leftover bytes produce padding:
| Input bytes | Output characters | Padding |
| 1 | 4 | == |
| 2 | 4 | = |
| 3 | 4 | none |
| n | 4 * ceil(n / 3) | 0 to 2 pad characters |
Example: hi (2 bytes) becomes aGk=, while hey (3 bytes) becomes aGV5 with no padding at all.
Frequently asked questions
Is this Base64 encoder / decoder free?
Yes. The tool is completely free, requires no sign-up, and has no usage limits. Everything runs locally in your browser, so your data is never uploaded to a server.
Is Base64 a form of encryption?
No. Base64 is only an encoding — a different way to write the same data, not a way to protect it. Anyone can decode it instantly without a key, so it offers zero confidentiality. Use real encryption (e.g. AES) for secrets.
How does this tool handle UTF-8 and Unicode text?
Encoding first converts your text to UTF-8 bytes with TextEncoder and then Base64-encodes those bytes. Decoding reverses the process with TextDecoder, so emoji, accented characters, Chinese, Arabic and every other Unicode text round-trip correctly.
What is URL-safe Base64?
Standard Base64 uses + and /, which have special meanings in URLs and filenames. URL-safe Base64 (RFC 4648) replaces + with - and / with _, and usually omits the = padding, so the encoded value can be placed safely in URLs, cookies and file names. Enable the URL-safe toggle above to produce it.