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.

0 bytes

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

Important: Base64 is an encoding, not encryption. Anyone can decode Base64 instantly, without a key or password.

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?
No. Base64 is an encoding, not encryption. It does not hide or protect information: anyone can decode it instantly. Never use it to store passwords or sensitive data as if it were secure.
Does it work with ñ, accents and emojis?
Yes. Unlike many tools that use btoa and break on non-English characters, this one processes text as UTF-8, so ñ, ç, accents and emojis are encoded and decoded correctly.
What is URL-safe Base64 (base64url)?
It is a variant that replaces the “+” and “/” characters with “-” and “_” and drops the “=” padding, so the result can be used in URLs and file names without issues. It is the format of the parts of a JWT token. When decoding, this tool accepts both variants automatically. If what you need is to encode the URL itself rather than its contents, use the URL encoder.
Is my text or file uploaded to a server?
No. Everything, including files, happens in your browser with FileReader; nothing is sent to any server. So you can encode sensitive information with peace of mind.
Can I convert an image to Base64?
Yes. Upload a file in “Encode” mode and you get its Base64 and its Data URI (data:image/...;base64,...), ready to embed in CSS or HTML. When decoding an image Data URI, a preview is shown.
Why do I get an error when decoding?
Base64 only allows letters, numbers and the symbols +/ (or -_ in URL-safe) with a length that is a multiple of 4. If the text has other characters or is incomplete, it is not valid Base64 and the tool warns you.