What is Base64 encoding?
Base64 represents arbitrary bytes using only 64 safe ASCII characters — A–Z, a–z, 0–9, + and / — so binary data can travel through channels designed for text: email bodies (MIME), JSON and XML payloads, HTTP headers such as Authorization: Basic, and data URIs in HTML and CSS. Every 3 bytes of input become 4 characters of output, so encoded data is about 33% larger, and = padding fills out the final group.
Base64 encodes bytes, not characters, which is where many tools go wrong. The browser's built-in btoa() only accepts Latin-1 and throws on emoji or most non-European text. This encoder converts text to UTF-8 first with TextEncoder, so 👋 correctly becomes 8J+Riw== and the result decodes identically in Python, PHP, Java or the command line.
Base64 is an encoding, not encryption: anyone can reverse it. Use it to transport data safely, never to hide it.
How to use the Base64 Encoder
- Choose Text to encode typed or pasted text, or File / image to encode a local file.
- For text, type or paste into the input box; the Base64 output updates as you type.
- Pick options if needed: the URL-safe alphabet, no padding, MIME (76) or PEM (64) line wrapping, or one encoded string per line.
- For files, drop or choose a file and select the output: raw Base64, a
data:URI, a CSSbackground-imagerule or an HTML<img>tag. Then copy or download it.
Example
The text Hi! ✓ is 7 bytes in UTF-8 (the check mark takes three). Standard and URL-safe encodings:
Standard: SGkhIOKckw==
URL-safe, no padding: SGkhIOKckwStandard, URL-safe and MIME variants
- Standard (RFC 4648 §4) uses
+and/with=padding. This is what most APIs, email and data URIs expect. - URL-safe, or base64url (RFC 4648 §5) replaces
+with-and/with_, which would otherwise need percent-encoding in URLs and are awkward in filenames. JSON Web Tokens use base64url without padding. - MIME (RFC 2045) wraps lines at 76 characters; email transports use CRLF line breaks. PEM files such as certificates and keys wrap at 64 characters.
When to use data URIs
Inlining small images or fonts as data: URIs saves an HTTP request, which can be worthwhile for tiny icons or for emails and single-file HTML where external files are not an option. For anything over a few kilobytes, a separate file is usually faster: it can be cached independently, downloaded in parallel, and it does not bloat your HTML or CSS by a third. For icons, an inline SVG is often smaller than any Base64-encoded bitmap.
Frequently Asked Questions
Why is my output different from another Base64 tool?
Usually because of the character encoding. Text must be converted to bytes before encoding; this tool uses UTF-8, which is the standard on the web. Tools that use Latin-1 or UTF-16 produce different output for any non-ASCII character. Line breaks in the input (LF versus CRLF) also change the result.
Is Base64 encryption?
No. Base64 has no key and is trivially reversible with the Base64 Decoder. To verify integrity, use a hash from the Hash Generator; to protect secrets, use real encryption.
When should I remove the = padding?
Padding is required by some decoders and optional for others. Omit it when the format says so, such as JWTs and many URL tokens, where = would otherwise need to be percent-encoded. The decoder on this site accepts both.
How large a file can I encode?
Up to 25 MB. The file is read and encoded in your browser and never uploaded; very large outputs are previewed partially, while Copy and Download always include the full result.
What is the difference between Base64 and URL encoding?
Base64 turns any bytes into a compact alphabet and is used for binary data. URL encoding (percent-encoding) keeps readable text readable and only escapes characters that are unsafe in URLs. For query strings, use the URL Encoder.