01 / Why
Safe in text
Base64 writes any data with 64 ordinary characters, so pictures and files can travel inside JSON, emails, HTML and CSS.
Free tool
Paste Base64 to read it, or type text to encode it, with any language and emoji kept intact. Base64 that holds a file is recognised from its first bytes, previewed, and downloaded with the right extension. Pick UTF-16 for PowerShell or Windows-1252 for older systems, do each line on its own, or switch to URL-safe Base64. Files and images go the other way too. Nothing leaves the browser, so keys and tokens stay private.
Need a custom tool, app or website? Contact us →Decoding accepts standard and URL-safe Base64, with or without = and line breaks, and data URLs.
Everything is converted in your browser. Nothing is uploaded or saved, so keys and tokens stay private. Only your settings are remembered on this device.
What Base64 is
01 / Why
Base64 writes any data with 64 ordinary characters, so pictures and files can travel inside JSON, emails, HTML and CSS.
02 / Size
Every 3 bytes become 4 characters, so Base64 is about 33% larger than the original.
03 / Not secret
Anyone can decode Base64. Never use it to hide a password.
Guide
Base64 decode turns a string of letters, numbers, + and / back into the text or file it was made from. Base64 is a way of writing any data with only 64 safe characters, so it can travel inside emails, JSON, web addresses and code. This tool decodes and encodes it in your browser: text comes back as UTF-8 with accents and emoji intact, and Base64 that holds a picture, PDF or other file is recognised, previewed and ready to download.
data:...;base64, are ignored, and URL-safe Base64 works too.If you paste plain words while Decode is selected, or Base64 while Encode is selected, a link above the box offers to switch. Swap flips the direction and moves the result into the input, so you can check a round trip.
Base64 holds bytes, not letters, so the same text gives different Base64 in different character sets. UTF-8 is the default and fits almost everything today. The other choices under Text encoding are for the places that still use something else:
-EncodedCommand. Encode a command with it and the result runs as written.With the default setting, Base64 that is not valid UTF-8 is treated as a file. If it still looks like Western text, it is shown as Windows-1252, and the status line says so.
Each line on its own treats every line as a separate value, which helps with a list of encoded IDs or names. Empty lines stay empty.
Base64 takes the data 3 bytes at a time. Those 3 bytes are 24 bits, which it splits into four groups of 6 bits. Each 6 bit group is a number from 0 to 63, and each number maps to one character: A to Z are 0 to 25, a to z are 26 to 51, 0 to 9 are 52 to 61, then + is 62 and / is 63.
| Step | M | a | n |
|---|---|---|---|
| Byte value | 77 | 97 | 110 |
| Bits | 01001101 | 01100001 | 01101110 |
Joined, those bits are 010011 010110 000101 101110. As numbers that is 19, 22, 5 and 46, which map to T, W, F and u. So "Man" encodes to TWFu. Decoding runs the same steps backwards.
When the data does not divide into groups of 3, the last group is padded with = signs. One byte left over gives two = signs, two bytes give one. That is why "Hi" encodes to SGk= and "Hello" to SGVsbG8=.
Every 3 bytes become 4 characters, so Base64 is about a third larger than the original. A 30,000 byte picture becomes 40,000 characters. A 3 MB file becomes about 4 MB of text. Lines of 76 characters add a line break every 76 characters on top of that. This is why Base64 is handy for small icons and keys but a poor way to move large files.
| Original | Base64 length |
|---|---|
| 3 bytes | 4 characters |
| 1,000 bytes | 1,336 characters |
| 30,000 bytes | 40,000 characters |
| 3,000,000 bytes | 4,000,000 characters |
Standard Base64 uses + and /, which have special meanings in web addresses and file paths. URL-safe Base64, also called base64url, uses a hyphen and an underscore instead and usually leaves off the = padding. You will see it in JSON Web Tokens, in links and in some API keys. When you decode, you do not need to pick: this tool accepts both kinds, with or without padding. When you encode, tick URL-safe if the result is going into a link or a token.
Anyone can decode Base64 in seconds, as this page shows. It hides nothing. If you find a password or key in Base64 in a config file, treat it as if it were written in plain text. That is also why it is safe to decode keys and tokens here: nothing is uploaded, and the work happens in this tab.
Terminal has a built-in base64 command. To decode some text, run echo 'SGk=' | base64 --decode, which prints Hi. To decode a file of Base64 into the original file, run base64 --decode -i input.txt -o output.png. To encode a file, run base64 -i photo.png. If the Base64 is on your clipboard, pbpaste | base64 --decode decodes it straight from there.
To read the header and payload of a token, use the JWT decoder. For pictures as data URLs with sizing tips, the image to Base64 tool goes further, and for percent signs in links, use URL encode and decode.
Questions
Many simple decoders treat text as Latin letters only, which breaks accents, other alphabets and emoji. This page reads and writes UTF-8, so text comes back exactly as it went in.
A version that uses - and _ instead of + and /, and usually drops the = padding, so it can sit in a web address or a file name. JSON Web Tokens use it.
For small icons, it saves a request. For larger pictures it makes the page heavier, since Base64 is about a third bigger and cannot be cached on its own. A normal image file is usually better.
Yes. Everything happens in this tab, and nothing is sent anywhere or saved. Only your settings, such as the direction and character set, are remembered on this device.
Press Encode, set Text encoding to UTF-16 LE (PowerShell), and type the command. The result goes after powershell -EncodedCommand.
Yes. Put each on its own line and tick Each line on its own. Every line is decoded separately.
A piece is missing, often from copying only part of a long line. Copy the whole value again, including any = at the end.
It uses only letters, digits, + and / (or hyphens and underscores for URL-safe), often ends in one or two = signs, and its length is usually a multiple of 4. Paste it here: if it decodes to readable text or a known file type, it was Base64.
It is padding. Base64 works in groups of 3 bytes, and when the last group is short, one or two = signs fill it out. They carry no data, so URL-safe Base64 often leaves them off.
Paste the Base64, with or without the data: prefix. The page recognises the type from the first bytes, shows a preview for pictures, PDFs, audio and video, and the Download button saves it with the right extension.
Yes. Base64 has no key or password. It is a way of writing data, not a way of protecting it, so anyone with the string can decode it.