How to encode text to Base64
- Type or paste your text into the box above.
- Tick URL safe if the result goes into a link or a cookie.
- Tick the 76 character wrap only for email or PEM files.
- Read the encoded text that appears right away.
- Copy the result or download it.
What this Base64 encoder gives you
- Full Unicode support for accents, world scripts and emoji.
- A URL safe variant with no padding.
- Optional line wrap at 76 characters for MIME and PEM.
- A live note on how much larger the encoded text is.
- Instant updates with no button to press.
- No upload so tokens and settings stay on your machine.
What is Base64 for?
Much of the internet carries text and nothing else. Email headers do. URLs do. JSON strings and HTTP headers do too. These systems may mangle or reject raw bytes.
Base64 maps any data onto 64 safe characters. It uses letters and digits. It adds the plus sign and the slash. Every one of those systems handles them fine.
The cost is size. Every three bytes become four characters. So encoded text runs about 33 percent larger. That is the price of safe travel through text only systems.
Where you meet Base64 every day
| Place | What it holds |
|---|---|
| HTTP Basic auth header | A username and password in Base64 |
| JSON Web Token | Three parts in URL safe Base64 |
| Data URI | A small image inside CSS or HTML |
| Email attachment | A file split into 76 character lines |
| PEM certificate | A key between BEGIN and END lines |
Why a good Base64 encoder must handle Unicode
The browser has a built in function called btoa. It accepts only characters below 256. Give it "café" and it throws an error. Give it an emoji and it fails too. Many online encoders break on text in other languages for this reason.
This tool turns your text into UTF-8 bytes first. Then it encodes those bytes. That order is correct. It means every script works. French and Greek encode cleanly. Arabic, Bengali and Japanese do too. Any system that decodes the result must read the bytes as UTF-8. Every modern system does that by default.
When to pick the URL safe variant
Standard Base64 uses + and /. Both mean something in a URL. A plus can stand for a space in a query string. A slash splits a path.
The URL safe variant swaps them for - and _. It usually drops the = padding too. Use it for anything inside a URL path or a query value. Use it for file names and cookies as well. JSON Web Tokens use this form. That explains the underscores you see in them.
Base64 is not encryption
This point needs plain words. Base64 has no key and no secret. Anyone can decode it in one click. The Base64 decoder on this site does it instantly.
So encoding a password gives zero protection. The same goes for an API key or personal data. It hides nothing from anyone who looks. Data that needs protection needs real encryption.
Common Base64 encoder problems
Another tool shows a different result
That tool may use a different text encoding. This tool uses UTF-8, the modern standard.
My link breaks with the encoded value
You used standard Base64 in a URL. Switch on the URL safe option.
The output has line breaks I do not want
Turn off the 76 character wrap. Keep it only for email and PEM files.
A quick Base64 encoder example
Type the word Hello into the box. The tool shows SGVsbG8=. The equals sign at the end is padding. It fills the last group up to four characters. Turn on the URL safe option and the padding goes away.
Tips for using Base64 well
- Keep Base64 for small data such as icons and tokens.
- Link large images as files and not as data URIs.
- Never treat Base64 as a way to hide secrets.
- Match the variant to the system that reads it.
Who uses a Base64 encoder?
Developers build auth headers and test APIs. Web designers embed small icons. Email teams check attachments. Students learn how encoding works.
Your text stays private
The tool runs in your browser. The text you paste never leaves your device. Want to encode an image file? Use the image to Base64 converter. Need to escape a link instead? The URL encoder handles that.