Base64 Encode & Decode
Encode and decode Base64 online with correct UTF-8 support (ñ, ç, accents and emoji), a URL-safe variant and files. All in your browser, nothing uploaded.
What is Base64?
Base64 is an encoding system that represents binary data using only 64 printable text characters (A–Z, a–z, 0–9, + and /), so it can be transported through channels that only accept text.
The idea is simple: bytes are grouped three at a time (24 bits) and split into four groups of 6 bits, each translated to one of those 64 characters. For example, the word “Man” (bytes 77, 97, 110) becomes “TWFu”. When the bytes are not a multiple of three, the “=” padding is added.
Base64 does not compress or protect anything; in fact it takes about 33% more space than the original. Its value is that binary data (an image, a file) can be placed inside text, an email, JSON or a URL without getting corrupted.
Base64 is NOT encryption
It is a very common mistake to think “encoding in Base64” hides or protects information. It does not: there is no secret, just a different way of writing the same data. So you should never use Base64 to store passwords, private tokens or sensitive data thinking they are safe.
The confusion often appears with JWT tokens, whose parts are in URL-safe Base64: they are readable, not encrypted. If you need real security, use encryption (AES, RSA) or hash functions, not Base64.
UTF-8, accents and emojis
This is where many tools fail. The browser’s btoa() function only understands Latin-1 characters, so it breaks or corrupts the result as soon as a ñ, a ç, an accent or an emoji appears.
This tool first converts the text to UTF-8 bytes with TextEncoder and then to Base64, so any character (Spanish, Portuguese, Chinese, emoji) is encoded and recovered exactly. If you work with legacy data that uses Latin-1 (ISO-8859-1), you can choose that charset in the options.
URL-safe Base64 (base64url)
Standard Base64 uses the “+” and “/” characters, which have a special meaning in URLs and file names. The URL-safe variant (base64url, RFC 4648) replaces them with “-” and “_” and removes the “=” padding, so the result can be pasted into a web address without breaking it.
It is the format used by the parts of a JWT token. Tick the “URL-safe” box to generate it; when decoding, the tool automatically accepts both the standard and the URL-safe form, so you do not have to worry about which one you were given.
What Base64 is used for
- Data URI: embed an image directly in CSS or HTML (
data:image/png;base64,…) to avoid an extra request. - Basic Auth: the username and password are sent in Base64 in the HTTP header (so always use HTTPS).
- Email and MIME: email attachments travel in Base64.
- JWT tokens: the header and payload are URL-safe Base64.
- APIs and JSON/XML: store binary data inside text without corrupting it.
If you work with other encodings, you also have our text to binary converter the Morse code translator and the URL encoder.
Frequently asked questions
Is Base64 encryption? Does it encrypt my text?
Does it work with ñ, accents and emojis?
What is URL-safe Base64 (base64url)?
Is my text or file uploaded to a server?
Can I convert an image to Base64?
Why do I get an error when decoding?
Related tools
Text to Binary
Convert text to binary and back (UTF-8).
Morse Code Translator
Translate text to Morse with sound.
Slug Generator
Create clean URLs from any text.
Clean Text
Remove formatting and invisible characters.
Character Counter
Count characters and bytes of your text.
Find and Replace
Replace text with regex support.