What Base64 Is, and How to Encode Text
By Tools Star Hub Editorial Team · Published · Updated
Base64 is a way to write binary data, or any UTF-8 text, with a limited set of ASCII characters. It is an encoding, not encryption. The Base64 encoder turns Hi into SGk=. Decoding SGk= returns Hi. The same page turns héllo into aMOpbGxv, because the accented letter takes more than one UTF-8 byte. Anyone can reverse the text. A password encoded this way is not hidden.
Some systems want a single line of ASCII for a small payload, a data URL, or a token part. Base64 does that without keeping the original bytes as raw binary. It also makes the text longer. Use it when a format asks for Base64. Do not use it as a substitute for a password hash or encryption.
What does Base64 actually change?
The encoder turns the text into UTF-8 bytes, then writes those bytes as Base64. Hi is the bytes for H and i, which encode to SGk=. The trailing equals sign is padding so the length fits the Base64 rules. hello encodes to aGVsbG8=.
héllo encodes to aMOpbGxv. The é is two UTF-8 bytes, so the result is not the same as a naive one-byte-per-letter conversion. Decoding uses the same path in reverse and returns the original text, including the accent.
Why is Base64 not a secret?
Decoding does not need a key. SGk= is Hi to anyone with a decoder, including this page. Whitespace in the encoded text is stripped before decoding, so a line break inside SGk= still decodes to Hi. That convenience is not protection.
A hash is different. SHA-256 of a password cannot be decoded on the Hash Generator. Base64 of a password can. If the goal is a fingerprint, use a hash. If the goal is a new password, use the password generator.
What are the limits on this page?
The encoder and decoder accept up to 750,000 characters. A larger paste is rejected. Invalid Base64 fails to decode instead of returning a guess. The page does not add a line wrap of its own.
Encoding a file is not the same as pasting its filename. This tool encodes the text in the box. It does not read a PDF or an image from disk unless you paste text. The work stays in the browser.
Base64 is longer than the original bytes. Four Base64 characters represent three bytes, with padding when the byte length is not a multiple of three. That growth is normal. It is not a sign that the text was encrypted or compressed.
A data URL puts a prefix such as data:text/plain;base64, in front of the encoded text. This page encodes or decodes the box only. It does not add that prefix, and it does not strip one for you. Paste the Base64 portion by itself when you want a decode.
How to encode or decode Base64
- Choose encode or decode. Encode when you have ordinary text and need Base64. Decode when you already have Base64 and need the text back.
- Paste the text. For encode, the characters are read as UTF-8. For decode, spaces and line breaks in the Base64 are ignored.
- Read the output. Hi encodes to SGk=. Decoding that value returns Hi. If decode fails, the input is not valid Base64.
- Do not treat the result as hidden. Anyone can decode it. Use encryption or a real access control if the text must stay private.
Example
Hi
Encoding Hi returns SGk=. Decoding SGk= returns Hi. A space inside the encoded form, such as SG k=, still decodes to Hi because whitespace is stripped.
An accented word
héllo encodes to aMOpbGxv. The accented letter is why the result is longer than a one-byte-per-letter guess. Decoding returns héllo.
Common mistakes
Padding is part of the encoding
The equals signs at the end of SGk= are padding. Do not delete them before you decode, unless you know the decoder you will use restores them.
It is not encryption
There is no key. Encoding a password with Base64 does not protect it.
FAQ
- What is the Base64 for Hi?
- SGk=. Decoding SGk= returns Hi. Whitespace inside the encoded text is removed before decoding.
- Is Base64 encryption?
- No. It is a reversible encoding. Anyone can decode it. A hash such as SHA-256 is one way. Base64 is not.
- Why is héllo not a simple letter mapping?
- The page encodes UTF-8 bytes. é is more than one byte, so héllo becomes aMOpbGxv.
- How much text can I paste?
- Up to 750,000 characters for encode or decode. A longer paste is rejected.
- Does encoding upload the text?
- No. The Base64 tool runs in the browser.
To encode or decode a snippet, use the Base64 encoder. It treats the text as UTF-8 and does not encrypt it.
For a one-way fingerprint instead, read How to hash text.
Base64 often shows up next to structured text. See What is JSON?.