Base64 Encoder & Decoder
Instantly encode and decode Base64 data in your browser. Perfect for developers, data processing, and API integration.
About Base64 Encoding
What is Base64?
Base64 is a binary-to-text encoding scheme that represents binary data in ASCII format. It's commonly used to encode binary data for transmission over text-based protocols like email and HTTP.
Common Use Cases
- Data URIs: Embedding images directly in HTML/CSS
- API Authentication: Basic auth headers
- Email Attachments: MIME encoding
- JSON Web Tokens: JWT payload encoding
- Configuration Files: Storing binary data in text configs
How Base64 Encoding Works
Base64 takes binary data and maps it onto a 64-character alphabet: the uppercase letters A-Z, lowercase a-z, the digits 0-9, plus + and /. The encoder reads input three bytes (24 bits) at a time and splits each group into four 6-bit chunks, each of which selects one character from the alphabet. Because every character in the output is printable ASCII, the encoded result survives systems that would corrupt raw binary: old mail gateways, text-only configuration formats, JSON strings, and HTML attributes.
The trade-off is size: three bytes of input always become four characters of output, so Base64 data is about 33% larger than the original. That is why embedding large images as data URIs can hurt page load times, while small icons are a good fit: the extra bytes cost less than an additional HTTP request.
One point worth stressing: Base64 is an encoding, not encryption. There is no key and no secret; anyone who sees a Base64 string can decode it instantly, including with this tool. Decoding is simply the reverse mapping, which is also why the decoder above can flag invalid input: any character outside the 64-character alphabet (plus padding) means the string is not valid Base64.
Frequently Asked Questions
Is Base64 encoding the same as encryption?
No. Base64 is an encoding scheme, not encryption. Anyone can decode a Base64 string back to the original data without a key or password. Never rely on Base64 to hide passwords, API keys, or other sensitive information. Use proper encryption for that.
Why does my Base64 string end with one or two equals signs?
The equals signs are padding. Base64 processes input in 3-byte groups, and when the input length is not a multiple of three, the encoder pads the final group. One equals sign means the last group contained two bytes; two equals signs mean it contained only one.
How much larger does Base64 make my data?
Base64 output is roughly 33% larger than the original input, because every 3 bytes of data become 4 encoded characters. A 300 KB image embedded as a data URI, for example, produces around 400 KB of text.
Why am I getting an invalid Base64 error when decoding?
Usually the string was cut short while copying, or it contains a character that is not part of Base64, such as a quote mark or a stray symbol. Valid Base64 only uses A-Z, a-z, 0-9, plus and slash (or hyphen and underscore in the URL-safe version), with up to two equals signs at the end. This tool ignores spaces and line breaks and accepts both the standard and URL-safe versions, so you can paste wrapped text from an email or a JWT segment as it is.
Is Base64 safe to use in URLs?
Not directly. Standard Base64 uses the plus and slash characters, which have special meanings in URLs. The URL-safe variant, called base64url, replaces plus with a hyphen and slash with an underscore, and usually drops the equals sign padding. This is the variant used inside JSON Web Tokens. Tick the URL-safe option when encoding to get it, and the decoder reads both kinds.
Can this tool encode emoji or non-English text?
Yes. Base64 works on bytes, so the tool first turns your text into UTF-8 bytes and then encodes those. Emoji, accented letters and scripts like Japanese or Arabic all work, and decoding turns the UTF-8 bytes back into the same text.
Related Tools
Need more text processing tools? Check out our Hash Generator for SHA-256 and SHA-1 hashes, Text Case Converter for formatting, or JSON Formatter for data validation.