Base64 encoding was invented to solve a specific problem: binary data cannot be safely transmitted over protocols designed for plain text. Early email systems, HTTP headers, and XML documents were built to handle ASCII text — not the raw bytes that make up images, audio files, or compressed archives. When those systems encountered a binary zero byte or a control character, they often corrupted or truncated the data. Base64 solves this by converting any binary input into a safe subset of 64 printable ASCII characters: A–Z, a–z, 0–9, plus + and /.
The encoding algorithm works in groups of three bytes. Each group of 3 bytes (24 bits) is split into four 6-bit values, and each 6-bit value maps to one of the 64 characters in the Base64 alphabet. If the input length is not a multiple of 3, one or two = padding characters are appended to make the output length a multiple of 4. This predictable structure makes Base64 easy to detect and decode reliably.
Because three bytes of input produce four characters of output, Base64 increases data size by exactly one third. A 1 MB image becomes approximately 1.33 MB as a Base64 string. This size penalty is the primary tradeoff. Common use cases where it is worth it include embedding images in HTML or CSS as data URIs (avoiding an extra HTTP request), encoding email attachments in MIME format, storing binary data in JSON payloads, and transmitting cryptographic keys or certificates in PEM format.
Consider a developer building an HTML email template who needs to include a small company logo. External image URLs are frequently blocked by corporate email clients — Outlook, Gmail, and Apple Mail all have different rules about loading remote images. The reliable solution is to embed the image as a Base64 data URI directly in the img tag's src attribute.
She takes her 2 KB PNG logo and converts it to Base64, producing a ~2.7 KB string. She embeds it as <img src="data:image/png;base64,iVBORw0KGgo...">. The browser (or email client) renders this identically to a file reference — same pixel-perfect image, same quality — but with zero additional HTTP requests. The entire email is self-contained.
To see the encoding step by step, consider the string Hello. Its ASCII bytes are 72, 101, 108, 108, 111. Grouping into sets of three: 72 101 108 and 108 111 (with padding). The first group in binary is 010010000110010101101100, split into four 6-bit chunks: 010010 (18 → S), 000110 (6 → G), 010101 (21 → V), 101100 (44 → s). The second group produces bG8=. Combined result: Hello → SGVsbG8=. Paste Hello into the encoder above to verify this result instantly.
Base64URL is a URL-safe variant that replaces + with - and / with _, and typically omits the = padding. This matters because standard Base64 characters +, /, and = have special meanings in URLs and query strings. JSON Web Tokens always use Base64URL encoding for their header and payload sections.
Line length limits matter in email contexts. The MIME specification requires Base64-encoded content to be split into lines of 76 characters maximum. Most email libraries handle this automatically, but if you are manually constructing MIME messages, a missing line break can cause some mail servers to reject the message.
When not to use Base64: the 33% size increase becomes significant for large files. A 10 MB video encoded as Base64 becomes 13.3 MB and must be decoded in memory before use. For large binary transfers, use multipart form data or a direct binary HTTP body. Base64 is best suited for small assets — icons, thumbnails, short strings — where the HTTP round-trip overhead outweighs the size penalty, or where the protocol requires text-only transmission.
Most base64 encode tools send your data to a remote server. That means your files, API keys, and private content pass through someone else's infrastructure. encodedecode.app is different: every base64 encode and base64 decode operation runs in your browser using native btoa(), atob(), and TextEncoder. Zero outbound requests.
Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It is commonly used to encode binary data — such as images or files — for transmission over text-based protocols like email or HTTP. base64 encode operations increase size by approximately 33%.
Switch to Decode mode using the toolbar above. Paste your Base64 string into the left panel and the decoded output appears instantly on the right. encodedecode.app supports standard Base64, URL-safe Base64 (with - and _ instead of + and /), and handles padding automatically.
No. All base64 encode and decode operations run entirely in your browser using native JavaScript APIs (btoa, atob, TextEncoder). Your data never leaves your device. You can verify this by opening DevTools → Network tab — zero outbound requests during encoding.
Standard Base64 uses + and / as characters 62 and 63, and = for padding. These characters have special meanings in URLs. Base64URL (also called URL-safe Base64) replaces + with -, / with _, and omits padding. Use the URL-safe toggle to switch between formats.
Yes. Drag and drop any file onto the input panel to base64 encode it. The tool uses the FileReader API to read the file locally — it is never uploaded. After encoding, you can see the full data URL (data:mime;base64,...) and download the result. Image files show a thumbnail preview.