How to encode and decode Base64
- Choose encode or decode.
- Paste your text, or pick a file to turn into Base64 or a data URI.
- Tick URL-safe if the result is going into a web address or token.
- Copy the result.
Base64 is encoding, not encryption
Base64 rewrites any data using 64 safe characters: A to Z, a to z, 0 to 9, plus + and /, with = used as padding at the end. It exists so binary data, such as an image or a file attachment, can travel through systems built for plain text, like email and JSON.
Anyone can decode Base64 in a second, with no key or password. It hides nothing. If you find a password, API key or personal data stored "encrypted" in Base64, treat it as stored in plain text. For real protection you need encryption, such as a password-protected file or HTTPS in transit.
Encoding also makes data bigger. Every 3 bytes become 4 characters, so a 300 KB image becomes about 400 KB of Base64.
UTF-8, URL-safe Base64 and data URIs
Base64 works on bytes, so text must first be turned into bytes. Some simple tools only handle basic English characters and fail or give the wrong answer on "£" or an emoji. This one converts text to UTF-8 first, so £5 encodes to wqM1 and decodes back to £5.
Standard Base64 uses + and /, which have special meanings in web addresses. The URL-safe variant swaps them for - and _, and usually drops the = padding. You will see it in JSON Web Tokens and in links that carry data.
A data URI puts a whole file inside a single string, for example data:image/png;base64, followed by the encoded image. You can drop that straight into HTML or CSS as an image source. It suits small icons. For larger images a normal file is usually better, because of the extra third in size.
Questions people ask
Is Base64 secure?
No. It is a reversible encoding that anyone can decode without a key. Never rely on it to hide passwords or personal data.
Why does my Base64 end with = or ==?
The equals signs are padding, added when the input length is not a multiple of 3 bytes. They tell the decoder how many bytes the last group holds.
Why does decoding give strange characters?
The original may not be text, such as an image or a zip file, or it was encoded from a different character set. Try decoding it as a file instead.
What is the difference between Base64 and URL-safe Base64?
URL-safe Base64 replaces + with - and / with _, so the result can sit in a web address without being altered. Padding is often left off.
Are my files uploaded when I encode them?
No. Files are read and encoded in your browser and never leave your device.