User Rating 0.0 โ˜…โ˜…โ˜…โ˜…โ˜…
Total Usage 0 times
0 chars
0 chars
Is this tool helpful?

Your feedback helps us improve.

โ˜… โ˜… โ˜… โ˜… โ˜…

About

Base64 encoding represents binary data using 64 printable ASCII characters (A - Z, a - z, 0 - 9, +, /) plus = for padding. Every 3 input bytes produce 4 Base64 characters, inflating size by approximately 33%. Malformed padding or illegal characters outside the Base64 alphabet will cause silent data corruption in tolerant parsers. This tool uses strict validation: it rejects input containing characters outside the canonical alphabet and verifies that padding conforms to RFC 4648 ยง4 before decoding.

Decoding operates through the native atob function, then pipes the resulting binary string through a TextDecoder set to UTF-8 to handle multi-byte sequences correctly. Encoding reverses the path via TextEncoder and btoa. Note: this tool processes text payloads. Binary files encoded as Base64 will decode to their raw byte representation displayed as text, which may appear garbled for non-text formats.

base64 ascii decoder encoder converter text encoding utf-8 binary

Formulas

Base64 encoding maps every group of 3 octets (24 bits) into 4 sextets (6 bits each). The output length is computed as:

Lout = 4 โ‹… Lin3 (rounded up to nearest integer)

Where Lin = number of input bytes and Lout = number of Base64 characters including padding. When Lin mod 3 โ‰  0, padding characters = are appended:

P = 3 โˆ’ (Lin mod 3)

Where P = number of = padding characters (0, 1, or 2). Each Base64 digit maps to a 6-bit value via the index table: A = 0, B = 1, โ€ฆ, / = 63. The decoding reversal extracts 6-bit indices, concatenates them into a bit stream, then splits into 8-bit octets to recover the original bytes.

Size ratio: LoutLin = 43 1.333

This means Base64 encoded data is always approximately 33.3% larger than the original binary input.

Reference Data

ASCII CharacterDecimalHexBinaryBase64 Index
A650x41010000010
B660x42010000101
Z900x5A0101101025
a970x610110000126
z1220x7A0111101051
0480x300011000052
9570x390011100161
+430x2B0010101162
/470x2F0010111163
= (pad)610x3D00111101Padding
Space320x2000100000 -
!330x2100100001 -
~1260x7E01111110 -
DEL1270x7F01111111 -
NUL00x0000000000 -
TAB90x0900001001 -
LF100x0A00001010 -
CR130x0D00001101 -
@640x4001000000 -
#350x2300100011 -

Frequently Asked Questions

Base64 processes input in groups of 3 bytes. When the input length is not divisible by 3, padding characters (=) are added to make the encoded output a multiple of 4 characters. One byte remainder produces "==", two bytes remainder produces "=". If the input is exactly divisible by 3, no padding appears. Per RFC 4648 ยง3.2, the padding ensures decoders can unambiguously determine the original byte count.
This tool automatically strips all whitespace, newlines (LF, CR), and tab characters before decoding. Many systems (e.g., MIME email, PEM certificates) insert line breaks every 76 characters per RFC 2045. The stripping is applied before validation, so pasted multi-line Base64 blocks decode correctly.
Yes. The encoder uses TextEncoder to convert the input string to UTF-8 bytes before applying btoa(). The decoder reverses this by passing the binary string through TextDecoder set to UTF-8. This correctly handles multi-byte sequences including emoji (up to 4 bytes per codepoint), CJK characters, and any Unicode text. Pure atob() alone would fail on multi-byte characters.
Standard Base64 (RFC 4648 ยง4) uses "+" and "/" as indices 62 and 63. URL-safe Base64 (RFC 4648 ยง5) replaces these with "-" and "_" to avoid conflicts with URL reserved characters. This tool supports standard Base64. If you have URL-safe input, manually replace "-" with "+" and "_" with "/" before decoding.
The tool warns at inputs exceeding 5 MB of text. JavaScript strings in modern browsers can hold hundreds of megabytes, but the DOM rendering of very large outputs may cause noticeable lag. For inputs under 1 MB, conversion is effectively instantaneous. The atob()/btoa() native functions are implemented in C++ within the browser engine, so the encoding/decoding step itself is fast.
If the original data was a binary file (image, PDF, ZIP), decoding it to text will show raw byte values as characters, which appear garbled. This tool is designed for text-to-text conversion. Binary file payloads decoded here will not render correctly as text. Additionally, if the source was encoded with a different character set (e.g., ISO-8859-1 instead of UTF-8), mismatched decoding will produce mojibake.