What Is Base64 and How to Encode and Decode It
Base64 turns data into plain letters, numbers and a few symbols, so it can travel safely through systems that only handle text.
On this page 1 min read
What Base64 does
Base64 represents data using 64 characters: A to Z, a to z, 0 to 9, plus + and /. The = sign is added at the end as padding. Encoded text is about one third longer than the original.
Example
The text Hello encodes to SGVsbG8=. Decoding SGVsbG8= gives back Hello.
Where Base64 is used
- Embedding small images in HTML or CSS as data URLs.
- Sending attachments in email.
- Putting binary data inside JSON or URLs.
- Basic authentication headers on the web.
Base64 is not encryption
Anyone can decode Base64, so it hides nothing. Never use it to protect passwords or private data. Use proper encryption for that.
How to encode and decode
- Open the Base64 Encode and Decode tool.
- Type or paste your text into the box.
- Press Encode to turn text into Base64, or Decode to turn Base64 back into text.
The tool uses UTF-8, so accented letters and non-English text encode correctly.
Common problems
- Invalid Base64 message: the text contains characters outside the Base64 set, or a part is missing.
- Strange characters after decoding: the data was not text, for example an image file.
- Spaces or line breaks added by email can break decoding. Remove them first.