"It's in Base64, so it's encrypted." That often-repeated line is false, and it can be costly: Base64 protects nothing. It's a way of writing any data as text, exactly as public as the original data. In this guide you'll see how it works, what it's really for (and that's a lot), why anyone can decode it in a second, and what to use when what you need is to protect information.
What Base64 is
Files and many kinds of data are binary: sequences of bytes that don't map to letters. There are places those bytes can't travel as is —the body of an email, an HTTP header, a JSON document, a URL, a stylesheet— because they expect text. Base64 solves that: it takes bytes three at a time (24 bits), splits them into four 6-bit groups and represents each group with one of 64 "safe" characters: A-Z, a-z, 0-9, + and /. If bytes are left over at the end, it pads with =. The result is text any system accepts, at the cost of being 33% larger.
An example: the word Hola is the bytes 72, 111, 108, 97. In Base64 it's written SG9sYQ==. The two = signs show the last group was incomplete. Nothing has been hidden: it's the same information written in another alphabet, like converting a number from decimal to hexadecimal.
Why it is not encryption
Encrypting means transforming data so that only someone holding a key can recover it. Base64 has no key: the procedure to undo it is public, fixed and trivial, and every browser, every language and every web page does it in milliseconds. Pasting a Base64 password into a config file, an email or a repository is exactly the same as pasting it in plain text, except it also gives a false sense of security. The same goes for a token, an API key or a card number.
One case is especially confusing: JWTs (the session tokens many apps use). They have three parts separated by dots, and the first two are JSON in Base64 (the URL-safe variant, with - and _). Anyone holding the token can read what it says: user, roles, expiry date. The third part is a signature that prevents modifying it, but not reading it. That's why a JWT should never carry sensitive data in its body.
What it is really for
- Embedded images (data URI):
<img src="data:image/png;base64,iVBOR…">puts a small icon or logo inside the HTML or CSS, with no extra request. For large images it doesn't pay off: they weigh a third more and aren't cached separately. - Email attachments: the MIME format encodes every attachment in Base64 so it can travel over a text-oriented protocol.
- HTTP basic authentication: the
Authorization: Basic …header carriesuser:passwordin Base64. That's why it's only acceptable over HTTPS: without transport encryption, the password is in plain sight. - JSON and APIs: sending a file (a signature, a photo) inside a JSON text field.
- Keys and certificates: PEM files (
-----BEGIN CERTIFICATE-----) are binary in Base64 with headers. - JWT, cookies and URLs: carrying small structures as a single string with no problematic characters.
Check it yourself: encode and decode text or files (with proper UTF-8 and the URL-safe variant) and you'll see no key is needed. All in your browser, and what you paste never leaves it.
Open the Base64 encoder →Variants and common mistakes
URL-safe: since + and / mean something in a URL, there's a variant that swaps them for - and _ and usually drops the = padding. It's the one JWTs and many activation links use; if decoding a "normal" one fails, try the other. Accents and emoji: Base64 encodes bytes, not letters, so the text must first be converted to bytes (UTF-8). The browser's classic function, btoa, only accepts single-byte characters: that's why in many tools "canción" or an emoji errors out or comes out wrong. Ours converts to UTF-8 first. Line breaks: some systems split Base64 into 76-character lines; when decoding, they must be ignored.
What to use when you actually need to protect data
If you have to store passwords, they're neither encrypted nor encoded: they get a slow, salted hash (bcrypt, scrypt or Argon2) that can't be undone. If you have to transmit sensitive data, the channel must be encrypted (HTTPS/TLS) and the content, if needed, with real keyed encryption (AES-GCM, for example, available in the browser via Web Crypto). If you have to check that a file hasn't changed, use a hash like SHA-256, which you also have in our developer tools. And if what you need is a random key or secret, generate it with the password generator; in are online password generators safe? we explain why where it's generated matters.
Frequently asked questions
Does Base64 compress?
The opposite: it increases size by 33% (every 3 bytes become 4 characters). If you need to shrink, compress first (gzip, or an image in WebP) and encode afterwards.
How do I know if a string is Base64?
It only contains letters, digits, + and / (or - and _), its length is a multiple of 4 (counting the = padding) and, decoded, it produces something meaningful. Looking like Base64 doesn't guarantee it is: a hex hash, for instance, is also "odd-looking text".
Is it safe to paste a token into an online tool to decode it?
Only if the tool works in your browser. A decoder that sends what you paste to a server has just received your token. Our developer tools have no backend: you can disconnect from the internet and keep using them.
Conclusion
Base64 is a transport tool, not a security tool: it turns bytes into text so they can pass where only text fits, and anyone can undo it without a key. Use it for data URIs, attachments, JWTs and APIs; never to "hide" passwords or data. And when you want to encode, decode or inspect a string, do it with the EzzyApps Base64 encoder, which processes everything in your browser.