English
How to encode and decode Base64
This Base64 encoder and decoder works in both directions at once. Type plain text on the left and the Base64 appears on the right; paste Base64 on the right and the decoded text appears on the left. Hello becomes SGVsbG8=, and pasting SGVsbG8= gives you Hello back.
The same two boxes handle four other formats: binary, hex, URL encoding and HTML entities. When you paste something on the right, the tool looks at it and switches to the matching format, so a string of 0s and 1s is read as binary without you picking anything. If you paste an encoded string into the plain-text box by mistake, it offers to decode it instead.
What Base64 actually does
Base64 turns any bytes into 64 safe characters (A–Z, a–z, 0–9, + and /), so binary data can travel through systems built for text: email, JSON, HTML attributes, environment variables. It takes 3 bytes (24 bits), splits them into four 6-bit pieces and writes one character for each piece.
When the input isn't a multiple of 3 bytes, = signs pad the end: Ma is TWE= and M is TQ==. Base64 is not encryption. Anyone can decode it in a second, so never treat a Base64 password as hidden.
Standard or URL-safe?
The + and / characters break URLs and file names, so the URL-safe variant uses - and _ instead and usually drops the padding. Bytes FB FF are +/8= in standard Base64 and -_8 in URL-safe form. JWT tokens and many API keys use the URL-safe form. When decoding you don't need to choose: both alphabets are accepted, with or without padding, and spaces or line breaks are ignored.
Tick Line breaks every 76 when you need MIME-style output for email bodies or PEM certificates.
Common characters in every format
Everything here is converted through UTF-8, the encoding used by nearly every website and API. That is why é takes two bytes and an emoji takes four. Tools that skip this step mangle accented letters, which is the most common complaint about online Base64 decoders.
| Character | Base64 | Binary | Hex | URL |
|---|---|---|---|---|
| A | QQ== | 01000001 | 41 | A |
| a | YQ== | 01100001 | 61 | a |
| space | IA== | 00100000 | 20 | %20 |
| & | Jg== | 00100110 | 26 | %26 |
| é | w6k= | 11000011 10101001 | C3 A9 | %C3%A9 |
| € | 4oKs | 11100010 10000010 10101100 | E2 82 AC | %E2%82%AC |
Text to binary and binary to text
Choose Binary and each byte of your text is written as 8 bits. Hi becomes 01001000 01101001. Turn off Space between bytes for one unbroken string.
As a binary to text translator, paste the bits into the right-hand box. Groups of 8 are read as bytes. Some websites print ASCII with 7 bits (1001000 1101001); as long as the groups are separated by spaces, they are padded with a leading zero and read correctly. Without spaces, the total has to be a multiple of 8, and the error message tells you how many bits it found so you can spot the missing digit.
Hex works the same way, two digits per byte. On the decoding side, prefixes and separators like 0x, \x, colons and commas are stripped, so you can paste straight from a debugger or a C array.
URL encode and decode
URL encoding replaces unsafe characters with % and two hex digits: a space becomes %20, é becomes %C3%A9. Pick the right scope:
- Component encodes everything except letters, digits and - _ . ! ~ * ' ( ). Use it for a single query value, such as ?q=rock%20%26%20roll. If you used Full URL here, the & would stay and split your parameter in two.
- Full URL leaves : / ? # & = alone, so a whole address stays clickable.
- Spaces as + matches how HTML forms send data. Tick it when decoding text copied from a form submission or a search URL, otherwise the + signs stay in the result.
HTML entities
The HTML mode escapes the five characters that can break markup: & < > " and '. So <b> becomes <b> and shows up as text instead of turning bold. Decoding understands named entities like é and as well as numeric ones like € (€).
Image to Base64 data URI
Drop a file in the bottom box to get its Base64, ready as a data URI, a bare string, an <img> tag or a CSS background. The size readout shows the cost. Base64 adds a third, so it pays off only for small things like a 1 KB icon, where saving an HTTP request matters more than the extra bytes. For a 200 KB photo, a normal image file is better: it is smaller, it caches, and it doesn't bloat your HTML or CSS.
| File size | Base64 size |
|---|---|
| 1 KB (1,024 bytes) | 1,368 characters |
| 10 KB | 13,656 characters |
| 50 KB | 68,268 characters |
| 1 MB | 1,398,104 characters |
The reverse works too. Paste Base64 or a data URI on the right and, if it isn't text, the tool reads the first bytes to work out the file type (PNG, JPEG, GIF, WebP, PDF, ZIP, MP3 and more), shows a preview for images and offers a download with the right extension.
Nothing is uploaded. That matters more than usual here, because the strings people decode are often API keys, session tokens and email attachments.
Frequently asked questions
How do I decode Base64?
Paste the Base64 into the right-hand box and the decoded text appears on the left straight away. For example SGVsbG8= decodes to Hello. If the result is an image or PDF rather than text, a Save as file button appears instead.
How do I convert text to binary?
Pick Binary and type your text on the left. Each byte becomes 8 bits, so Hi turns into 01001000 01101001. Letters outside English, like é, take two or more bytes in UTF-8 and therefore 16 or more bits.
How do I translate binary code back to text?
Choose Binary and paste the 0s and 1s into the right-hand box. Groups of 8 bits are read as bytes, so 01001000 01101001 reads Hi. Groups of 7 bits separated by spaces also work; they are padded with a leading 0.
How do I turn an image into a Base64 data URI?
Drop the image into the file box at the bottom and copy the result. A PNG becomes data:image/png;base64,iVBORw0KGgo… which you can paste into an img src or a CSS background. Expect it to be about 33% larger than the file.
Why is Base64 about 33% bigger than the original?
Base64 writes every 3 bytes as 4 characters, so 30 KB of image becomes about 40 KB of text. MIME line breaks every 76 characters add roughly 2.6% more. That is why data URIs only make sense for small files.
What is the difference between Base64 and URL-safe Base64?
URL-safe Base64 swaps + for - and / for _, and often drops the = padding, so the text can sit in a URL or file name. JWT tokens use it. This decoder accepts both alphabets automatically.
How do I decode a URL with %20 and %3A in it?
Choose URL and paste the text on the right. %20 becomes a space and %3A a colon, so https%3A%2F%2Fexample.com reads https://example.com. Tick Spaces as + if the text comes from a form, where spaces are written as +.
Is my text or file sent to a server?
No. All encoding and decoding runs in your browser with JavaScript, so it is safe for API keys, tokens and private files.