Base64 encoder / decoder

    πŸ”’ Runs entirely in your browser. Nothing you enter is sent to any server.

    Advertisement

    How Base64 encoding works

    Base64 is a way of representing binary data as plain ASCII text β€” it converts every 3 bytes of input into 4 printable characters drawn from a 64-character alphabet (A–Z, a–z, 0–9, + and /, with = used for padding). The encoded output is always about 33% larger than the input, which is the trade-off for making arbitrary data safe to transmit through text-only channels.

    What Base64 is used for

    Embedding small images directly in HTML or CSS (data URIs), encoding the header and payload of a JWT token, attaching binary files in email (MIME), and pasting binary content into JSON, XML or other text-only formats that can't safely contain raw bytes. It's an encoding, not encryption β€” anyone can decode it back to the original data instantly, so it shouldn't be used to hide or protect sensitive information.

    Why the output is longer than the input

    Base64 maps every 3 bytes (24 bits) of input to 4 characters (24 bits) of output, so the encoded form is always about 4/3 β€” roughly 33% β€” larger than the original. If the input length isn't a multiple of 3, one or two = padding characters are added at the end to keep the output length a multiple of 4.

    Base64 vs URL encoding

    Base64 encoding converts arbitrary binary data into a text-safe representation using 64 printable characters. Percent-encoding (URL encoding) instead replaces only the specific characters that are unsafe inside a URL, leaving the rest untouched. They solve different problems: use Base64 for embedding images or binary data in text formats; use URL encoding for values placed inside a URL or query string.