User Rating 0.0 β˜…β˜…β˜…β˜…β˜…
Total Usage 0 times
Quick presets:
Is this tool helpful?

Your feedback helps us improve.

β˜… β˜… β˜… β˜… β˜…

About

Binary and Base64 are two fundamentally different encoding schemes for representing raw byte data as text. Binary notation expresses each byte as 8 bits (e.g., 01001000 for the ASCII character H), while Base64 maps every group of 3 bytes (24 bits) into 4 printable ASCII characters drawn from a 64-symbol alphabet (A - Z, a - z, 0 - 9, +, /). Misaligned bit grouping is the most common source of corruption: if your binary string length is not divisible by 8, the trailing bits produce an invalid byte and the entire output is wrong. This tool validates alignment before conversion.

The converter handles both directions. It groups binary digits into octets, computes each byte value, then applies RFC 4648 Base64 encoding. The reverse path decodes each Base64 character back to its 6-bit index, reconstructs bytes, and formats them as zero-padded 8-bit binary strings. Note: this tool operates on raw byte data. It does not interpret character encodings beyond ASCII/Latin-1 in the Base64 path. For multi-byte UTF-8 sequences, encode the UTF-8 bytes in binary first.

binary to base64 base64 to binary binary converter base64 encoder binary string data encoding byte conversion

Formulas

Base64 encoding operates on groups of 3 bytes (24 bits), splitting them into 4 sextets of 6 bits each. Each sextet indexes into the Base64 alphabet to produce one output character.

bytei = parseInt(binaryOcteti, 2)

For every 8-bit binary chunk, the decimal byte value is computed by interpreting the string as a base-2 integer.

base64Output = btoa(String.fromCharCode(byte0, byte1, …, byten))

The assembled bytes form a raw binary string, which is then encoded using the standard Base64 algorithm per RFC 4648.

outputLength = 4 β‹… n3

Where n is the number of input bytes. When n is not divisible by 3, padding characters (=) are appended: 1 remainder byte produces 2 padding chars, 2 remainder bytes produce 1.

The reverse conversion decodes each Base64 character back to its 6-bit value, reconstructs 8-bit bytes, then formats each byte as a zero-padded binary string:

binaryStringi = padStart(charCodei.toString(2), 8, "0")

Where charCodei is the byte value from the decoded Base64 string at position i.

Reference Data

ASCII CharacterDecimalBinary (8-bit)Base64 (solo byte)
NUL000000000AA==
TAB900001001CQ==
LF (\n)1000001010Cg==
Space3200100000IA==
04800110000MA==
95700111001OQ==
A6501000001QQ==
B6601000010Qg==
Z9001011010Wg==
a9701100001YQ==
z12201111010eg==
+4300101011Kw==
/4700101111Lw==
=6100111101PQ==
~12601111110fg==
DEL12701111111fw==
Γ‰20111001001yQ==
ΓΌ25211111100/A==
xFF25511111111/w==
Hi (2 bytes)72, 10501001000 01101001SGk=
Man (3 bytes)77, 97, 11001001101 01100001 01101110TWFu

Frequently Asked Questions

The converter rejects the input with an error. Each byte requires exactly 8 bits. A binary string of, say, 13 bits cannot be cleanly split into bytes. You must pad or trim to a multiple of 8 before converting. The tool reports how many excess bits remain so you can correct the input.
Yes. All spaces, tabs, newlines, and carriage returns are stripped before processing in both directions. You can paste binary with spaces between octets (e.g., 01001000 01101001) or Base64 with line breaks (as produced by MIME-encoded data), and the converter will process them correctly.
Base64 always outputs in blocks of 4 characters. One byte (8 bits) fills only 2 sextets (12 bits, with 4 padding bits set to zero). The remaining 2 positions are filled with = padding characters per RFC 4648. So 01001000 (ASCII H) becomes SA==.
Yes, as long as each byte is represented as an 8-bit binary string. The converter treats input as raw bytes with values 0 - 255. It does not assume any character encoding. You can encode arbitrary binary payloads (PNG headers, ZIP signatures, etc.) and the Base64 output will be identical to what a standard encoder produces.
No. This tool uses standard Base64 (RFC 4648 Section 4) which includes + and / characters. For URL-safe Base64 (RFC 4648 Section 5), you would need to replace + with - and / with _ in the output, and optionally strip = padding. This tool does not perform that substitution.
The converter runs entirely in-browser. Practical limits depend on available memory. Binary strings up to roughly 1 - 2 million characters (about 125 - 250 KB of data) convert instantly. Extremely large inputs may cause the browser tab to become unresponsive briefly. For multi-megabyte payloads, consider a streaming server-side tool.