How to use the base64 encoder and decoder
- Paste text or a Base64 string into the input box.
- Choose encode or decode.
- Copy the result.
What is Base64?
Base64 turns any data into a string made of 64 safe characters: A–Z, a–z, 0–9, + and /. It is used to put binary data into places that only accept text, such as email attachments, data URLs, JSON and HTTP authentication headers. Encoded text is about a third longer than the original.
Base64 is not encryption
Anyone can decode Base64, so never use it to hide passwords or secrets. To fingerprint data, use a hash such as SHA-256 instead.
Worked example
The word Hello encodes to SGVsbG8=. The pound sign £ is two bytes in UTF-8, so it encodes to wqM=. Decoding reverses the process and checks that the result is valid UTF-8 text, so damaged or truncated Base64 is reported as an error rather than shown as garbled characters.
Whitespace and line breaks in the input are ignored when decoding, which helps when you paste Base64 copied from emails, certificates or log files that wrap long lines.
Developers often meet Base64 in data URLs (data:image/png;base64,…), HTTP Basic authentication headers, JSON Web Tokens and email attachments (MIME).
Images and files to Base64
Choose an image under Image or file to Base64 to get a data URI you can paste straight into HTML or CSS, a plain Base64 string, a CSS background-image rule or a complete <img> tag. Small icons and logos embedded this way load without an extra request. To go the other way, paste a data URI or Base64 into Base64 to file and download the original file; images are previewed first.
Frequently asked questions
How do I convert an image to Base64?
Choose the image under ‘Image or file to Base64’ and copy the data URI or Base64 text. Nothing is uploaded.
Does this support emoji and accented characters?
Yes. Text is converted to UTF-8 first, so any Unicode character encodes and decodes correctly.
Why does my Base64 end with = signs?
The = characters are padding, added so the output length is a multiple of four.
Is Base64 secure?
No. It is an encoding, not encryption. Anyone can reverse it.