How to use the Binary to Base64 tool
- Paste the bits into the Binary bytes box. Group them however you like, as long as the total is a multiple of eight.
- Select Convert to pack the bits into bytes and encode the bytes as Base64.
- Read the Base64 string in the Result box. It is a single line with = padding where needed.
- Select Copy to take the string, or Example to encode the two sample bytes.
From bits to Base64 characters
Base64, defined in RFC 4648, re-cuts a byte stream into 6-bit groups and writes each group as one of 64 characters: A to Z for 0 to 25, a to z for 26 to 51, the digits for 52 to 61, then plus and slash. Three bytes are 24 bits, which is exactly four groups.
Seeing the input as bits makes the process visible. The tool first joins your digits into 8-bit bytes, then the encoder regroups the same bits by six. Nothing is calculated. The bits are only divided at different points.
Worked example: encoding 01001000 01101001
The two sample bytes are the letters H and i. Their 16 bits regroup as 010010, 000110 and 1001. The last group is short, so two zero bits are appended to make 100100. The values 18, 6 and 36 select the characters S, G and k.
Three characters are not a full block of four, so one equals sign is added. Two input bytes always end with one =, a single byte ends with ==, and a multiple of three bytes needs no padding.
01001000 01101001 -> SGk=
01001101 01100001 01101110 -> TWFu
11111011 11111111 -> +/8=
11111111 -> /w==Input rules and size limit
The converter is strict about byte boundaries so that a missing bit does not silently shift everything after it.
- Spaces, tabs and line breaks are removed before the bits are counted.
- The count must divide by eight. If it does not, you see: Enter complete bytes, using eight bits per byte.
- A single 0b at the start is allowed. Other characters, including commas, are rejected.
- The maximum is 65,536 bits. That is 8,192 bytes, which encode to 10,924 Base64 characters.
What kind of Base64 you get
The output uses the standard alphabet with plus and slash, keeps the = padding, and has no line breaks. That is the form data URLs, HTTP Basic credentials and most JSON APIs expect. MIME bodies and PEM files use the same alphabet but wrap long lines, which you would add yourself.
It is not the URL-safe variant. For a JWT segment or a URL parameter, replace + with -, replace / with _ and remove the padding. Also note that binary here means text made of the characters 0 and 1. The tool does not read binary files.
Frequently asked questions
How do I convert binary to Base64 by hand?
Write the bits in one row, split them into groups of six from the left, pad the last group with zeros, and look up each 6-bit value in the Base64 alphabet. Add = signs until the length is a multiple of four.
Why does the result end with one or two equals signs?
Padding marks an incomplete final block. If the byte count leaves a remainder of one when divided by three, the output ends with ==. A remainder of two gives a single =.
Is the output URL-safe Base64?
No. It is standard Base64 and may contain +, / and =. The bytes 11111011 11111111 encode to +/8=, for example. Swap the two symbols and strip the padding if you need Base64URL.
Why do I get the complete bytes error?
The number of 0 and 1 digits is not a multiple of eight. Count the bits in each group. A dropped leading zero is the usual cause, since 1001000 is seven bits where 01001000 was meant.
How do I turn the Base64 back into bits?
Use the Base64 to Binary tool on this site. It decodes the string and prints every byte as eight bits, so SGk= becomes 01001000 01101001.
Are my bits sent to a server?
No. Packing the bits into bytes and encoding them both run as JavaScript on this page. The value in the Binary bytes box is not transmitted anywhere.