Binary to Base64 Converter

Turn a run of ones and zeros into a compact Base64 string ready to travel as text.

Binary
Base64
Runs locally in your browser

About the Binary to Base64 Converter

Bits are the clearest way to describe data and the worst way to move it: eight characters for every byte, and no protocol wants to carry that. Base64 brings the same bytes down to roughly one and a third characters each, which is why it shows up wherever binary has to survive a text field.

Paste the digits in whatever shape you have them. Spaces, commas, semicolons, pipes, dots, hyphens, underscores and line breaks are all treated as separators and removed, and a 0b prefix on each group is dropped too, so output copied from a debugger or a lecture slide works without editing. What is left has to be a whole number of bytes: if the bit count is not a multiple of eight the tool reports the exact count instead of padding silently, because a guessed pad would change every byte that follows.

Any character that is not a zero or a one is named in the error, which catches the common case of a letter O typed where a zero belonged. Once the bytes are assembled the URL-safe checkbox swaps in the hyphen and underscore alphabet and drops the padding for use in tokens and paths, and the wrap options produce the 64 or 76 character blocks that PEM files and MIME bodies use.

The reverse trip is Base64 to Binary, and if your bits actually spell out a sentence then Binary to Text is the shorter route.

How to use

  1. Paste your binary digits, grouped or continuous, with any separator you like.
  2. Confirm the status line reports the byte count you expected.
  3. Tick URL-safe alphabet if the result belongs in a token or a path segment.
  4. Copy the Base64 or download it.

Common questions

My bit count is not a multiple of eight. What now?
Add the missing bits yourself, on the side where they belong. Padding automatically would silently shift every following byte.
Are separators required between bytes?
No. A continuous run of digits works, because the tool slices it into eight bit groups from the left.
Does it accept 0b prefixes?
Yes. A 0b in front of each group is stripped before the digits are read, along with commas and pipes.
Why is the Base64 so much shorter than my input?
Eight input characters describe one byte, while Base64 spends about 1.33 characters on the same byte.