What is Base64?
Base64 is a way of representing binary data — like images, files, or any text — using only 64 readable ASCII characters: A–Z, a–z, 0–9, plus the symbols + and /. It is not encryption and provides no security; it simply converts data into a text-safe form that can travel through systems that only handle plain text.
The name comes from the 64 characters in its alphabet. Every 3 bytes of input are turned into 4 Base64 characters, which is why Base64 output is always about one-third larger than the original data.
Why is Base64 used?
Many systems were designed to handle text, not raw binary. Base64 bridges that gap. Common uses include embedding images directly in HTML or CSS as data URLs, attaching files to emails (MIME), storing binary data in JSON or XML, and encoding credentials in certain API authentication headers.
For example, a small icon can be embedded straight into a web page as a Base64 data URL, removing the need for a separate file request and speeding up the page.
How to encode text to Base64
Step 1. Open the free Base64 Encoder / Decoder and make sure Encode mode is selected.
Step 2. Type or paste your text into the input box. The tool is UTF-8 safe, so accented characters, Arabic, Hindi, and even emoji all encode correctly.
Step 3. The Base64 result appears instantly on the right. Click copy to use it. For example, the word "Hello" encodes to SGVsbG8=.
How to decode Base64 back to text
Switch the tool to Decode mode and paste your Base64 string. The original text is recovered instantly. If decoding fails, the input is probably not valid Base64 — perhaps it is missing characters, contains extra spaces, or was never Base64 to begin with.
A quick way to recognize Base64 is that it often ends with one or two equals signs (=) used as padding, and it contains only letters, digits, +, and /.
Is Base64 secure?
No. This is the most important thing to understand: Base64 is encoding, not encryption. Anyone can decode it instantly with no key. Never use Base64 to hide passwords or sensitive data thinking it is protected. If you need security, use real encryption. Base64 is purely about making data portable as text.
A real example: encoding step by step
Suppose you want to encode the word Hi. Here is what happens behind the scenes:
- The letters become their byte values: H = 72, i = 105.
- Those bytes are written in binary: 01001000 01101001.
- Base64 regroups the bits into blocks of 6 and maps each block to one of its 64 characters.
- The result is
SGk=— where the trailing=is padding.
You never need to do this by hand. The point is to see why the output looks scrambled and slightly longer than the input: it is a faithful, reversible re-packaging of the original bytes.
Where you will actually see Base64
Base64 is everywhere once you know what to look for:
- Data URLs: small images embedded directly in HTML or CSS as
data:image/png;base64,...to avoid an extra file request. - Email attachments: the MIME standard encodes files in Base64 so they survive text-only mail systems.
- JSON and APIs: binary data such as images or tokens is sent inside JSON as Base64 strings.
- Basic auth headers: the username and password are joined and Base64-encoded (not encrypted) in the Authorization header.
- JWT tokens: the parts of a JSON Web Token are Base64url-encoded.
Base64 vs Base64url: a small but important difference
Standard Base64 uses the characters + and /, which have special meanings in URLs. To send Base64 safely inside a web address, a variant called Base64url replaces + with - and / with _. If a token from a URL fails to decode, this is often why — it is Base64url, not plain Base64.
Common mistakes to avoid
- Treating Base64 as security. It is reversible by anyone. Never store passwords as Base64 thinking they are protected.
- Forgetting padding. Removing the trailing
=signs can break decoding in some tools. - Mixing Base64 and Base64url. Decoding one as the other fails on the
+ / - _characters. - Encoding huge files. Base64 adds about a third to the size, so it is best for small assets, not large videos.
Try the Base64 tool
Encode and decode Base64 instantly and privately in your browser.
Try the Tool →