About Base64 encoding
What Base64 is for
Base64 turns any bytes into text made of 64 safe characters: A–Z, a–z, 0–9, + and /, with = as padding. It exists because many channels only carry text reliably. Email attachments (MIME), data: URLs in HTML and CSS, JSON fields that hold a file, HTTP Basic auth headers and JWT segments all use it.
Base64 is an encoding, not encryption. Anyone can decode it, so never use it to hide a password or a token.
How it works
The encoder reads the input three bytes (24 bits) at a time and splits them into four 6-bit groups. Each group is a number from 0 to 63 that picks one character from the alphabet. When the input does not divide evenly by three, the last group is padded with =, which is why Base64 strings often end in one or two equals signs.
Every 3 bytes become 4 characters, so encoded data is about 33% larger than the original. Text is turned into bytes as UTF-8 first, so accented letters, Chinese characters and emoji survive the round trip. For example, Hello encodes to SGVsbG8=.
Base64url and other variants
The standard alphabet uses + and /, which have special meanings in URLs and file names. The URL-safe variant (base64url, RFC 4648 §5) swaps them for - and _ and usually drops the padding. JWTs use it. This decoder accepts both alphabets, ignores line breaks and spaces, adds missing padding, and strips a data:…;base64, prefix, so you can paste a value straight from a token, an email source or an HTML attribute.
Decoding images and files
When the decoded bytes are an image (PNG, JPEG, GIF, WebP, BMP, ICO or AVIF), the tool shows a preview and lets you download the file. That makes it easy to check an inline image from a CSS file or an API response without writing it to disk first. SVG is deliberately not previewed, because an SVG can carry script. Everything runs in your browser, and nothing you paste is uploaded.
Frequently asked questions
- Why does my decoded text look like garbage?
- The bytes are probably not text. They may be an image, a zip file or encrypted data. It can also mean the text was encoded with a character set other than UTF-8, such as Latin-1 or Big5.
- Is Base64 secure?
- No. It is reversible by anyone, with no key. Use it to carry data, and use real encryption (for example AES or TLS) to protect it.
- How much bigger does Base64 make my data?
- About a third bigger: every 3 bytes become 4 characters, plus up to two padding characters. Line breaks added by MIME every 76 characters add a little more.