Base64 Encoder / Decoder
encode and decode Base64 strings and files in your browser
Try it now — free, instant, no signup
Base64 encoding converts binary or text data into a 64-character ASCII alphabet so it can travel safely through systems that only handle plain text. A common case: pasting a small PNG into CSS as background-image: url('data:image/png;base64,iVBORw0K...') avoids an extra HTTP request. Unlike most online converters, this tool supports URL-safe Base64 (replacing + and / with - and _) and handles binary file encoding, not just strings.
What is Base64 Encoder / Decoder?
Base64 is a binary-to-text encoding scheme that represents arbitrary byte sequences using only 64 printable ASCII characters (A–Z, a–z, 0–9, plus two symbols). Paste any UTF-8 string — say, {"user":"alice"} — and it encodes to eyJ1c2VyIjoiYWxpY2UifQ==. Paste a binary file and each group of three bytes becomes four Base64 characters, inflating size by roughly 33%.
Developers tend to reach for this when they need a quick encode-decode round-trip without leaving the browser. RapidTables has a Base64 page but only handles text, not binary files. CyberChef handles binary but requires selecting the right recipe from a long list. If you already have a terminal open, base64 (macOS/Linux) or certutil -encode (Windows) does the same job faster; use this tool when you want to paste a file and share the output without touching the command line.
One gotcha that bites people regularly: the browser's native btoa() function throws InvalidCharacterError on any character outside Latin-1 (codepoint > 255). This means calling btoa('café') crashes. The correct approach is to first encode the string to UTF-8 bytes via TextEncoder, then Base64-encode the resulting Uint8Array. This tool handles that conversion internally, but if you're writing your own code, that two-step pattern is the reliable path.
When to use Base64 Encoder / Decoder
- Embed a small icon or font file directly into a JSON config payload where binary attachments aren't supported.
- Decode a JWT's payload segment to inspect its claims before wiring up a full JWT library.
- Convert a Base64-encoded email attachment back to its original binary file when your mail client strips it.
Expert Notes
Base64 is an encoding, not encryption — it's trivial to decode and should never be used to obscure sensitive data. The standard alphabet uses `+` and `/`, which are URL-unsafe; use Base64url (RFC 4648 §5) with `-` and `_` instead when embedding in URLs, JWTs, or filenames. When encoding binary data for JSON payloads, watch for padding `=` characters — some parsers choke on them, and most Base64url implementations strip padding entirely.
DevLab's Take
The tool earns its keep for quick encode/decode tasks during API debugging or email attachment inspection — anything beyond that (bulk file processing, pipeline encoding) belongs in a script.
Frequently Asked Questions
Why does the Base64 output always end with one or two equals signs?
What is URL-safe Base64 and when do I need it?
Why is my decoded file corrupt after a Base64 round-trip?
Is Base64 a form of encryption or obfuscation?
What is the practical file size limit for encoding in the browser?
Related Tools
- URL Encoder / Decoderencode and decode URL percent-encoding for query strings and paths · Encoding
- HTML Entity Encoderencode and decode HTML entities for safe HTML embedding · Encoding
- JWT Decoderdecode JWT tokens and inspect header, payload, and claims · Encoding
- Hash Generatorgenerate MD5, SHA-1, SHA-256, and SHA-512 hashes from text · Encoding
Learn more
- Base64 Encoding ExplainedUnderstand what Base64 is, how it works, when to use it, and when not to.
- JWT Structure and How It WorksUnderstand JSON Web Tokens: their structure, how to decode them, and when to use (and not use) them.
- How JWT Works: Header, Payload, Signature DecodedUnderstand JWT structure, how HS256 and RS256 signing work, when to use JWT over sessions, and the security mistakes that get apps breached.