Base64 Converter
Encodes text to Base64 and decodes it back. Two alphabets – standard and URL-safe. You choose the direction, the converter does not guess.
Input
Report a problem
What Base64 is and what it is for
What this converter does
You paste text and say what to do with it: encode it to Base64 or decode it back. The converter shows the result, its length and how much the string grew or shrank.
Both directions are the same page and the same card. Only the choice in the "What to do" list changes.
Base64 is not encryption
Base64 hides nothing. It is a way to write any bytes with twenty-six capital letters, twenty-six lowercase ones, ten digits and two special signs – a set that is guaranteed to survive transfer through systems built only for text: email, JSON, XML, HTML attributes.
Anyone can decode Base64 instantly, without any key. A password written in Base64 is a password written in the open, just less obvious to the eye.
Why the result is longer than the original
Base64 takes three bytes and writes them as four characters. So the string grows by about a third: 100 bytes become 136 characters including padding. This is a property of the format itself, not of this converter.
In the other direction it is the same in reverse: decoded text is always shorter than the Base64 it came from.
Two alphabets: standard and URL-safe
Standard Base64 (RFC 4648) ends its alphabet with the characters + and /, and fills the gap to a multiple of four with the = sign.
All three characters have a special meaning in a page address and in a file name, so there they break the string. For such cases the standard describes a second alphabet: - instead of +, _ instead of / and no padding at all. That is URL-safe.
You choose the alphabet. If you paste a URL-safe string under the standard alphabet, the converter answers with an error and hints that there is a second option – but it does not translate one alphabet into the other silently. A silent translation would mean you got bytes from a string you thought was standard, and nothing said so.
Input can do without the = padding
On output the standard alphabet always pads the string to a length that is a multiple of four, and URL-safe never pads.
On input both are accepted. A lost tail of = is the most common thing that happens to Base64 on the way, and there is no reason to refuse because of it: no ambiguity arises here.
Spaces and line breaks
Base64 from an email, a PEM certificate or a terminal is usually split into lines of 64 or 76 characters. When decoding, spaces, tabs and line breaks are removed – they are not part of the data.
This is not done with plain text. A space at the start of a line is content, and encoding it along with everything else is the job.
When the result is not text
Base64 carries any bytes, not just text. A string can decode flawlessly and still turn out to be an image, an archive or text in another encoding.
In that case the converter says so directly: how many bytes came out and that they are not UTF-8 text. It does not show them with "boxes" instead of characters and does not pretend it read anything. This is a text converter, and the honest answer here is to name the limit.
Length limit
The field accepts up to 2000 characters. The request goes through the address bar, and an address that is too long is rejected by the server, not the page – so the limit is here, so that instead of a silent error you see a sentence.
Frequently asked questions about Base64
Is Base64 encryption?
No. It is an encoding: a transformation with no key and no secret. Anyone can decode it in a second.
Why are there = signs at the end of the string?
That is padding. Base64 works in blocks of three bytes; if the last block has one or two bytes, the string is filled up with one or two = signs to a length that is a multiple of four.
Why won't my string decode?
There are three common reasons: the wrong alphabet is chosen (a URL-safe string under the standard one), the string has a character outside the alphabet, or the length does not add up even allowing for missing padding.
Can I encode an image?
With this converter – no, it takes text from the field. You can decode the Base64 of an image, but the result will be a message that it is not text, and the number of bytes.
Do accented letters take up more space?
Yes. In UTF-8 a letter like é is two bytes, not one. So "café" is four characters and five bytes, and Base64 counts bytes.
Does the answer change over time?
No. The converter looks neither at the clock nor at the network: the same request always gives the same answer.
Base64 converter online – encode and decode
Base64 turns up wherever data has to pass through a channel built for text: in emails, in tokens, in settings, in data: addresses. This converter turns a string both ways and names the alphabet it uses.
How to use it
Paste text or Base64 into the field, choose the direction and the alphabet – the card with the answer appears by itself. There is nothing to click.