TOP

Free exact browser converter

Binary to Base64 Converter

Encode 8-bit binary groups or a local binary file as Base64. Preserve zero bytes and choose padded Base64 or unpadded Base64url.

No signupRuns locally in your browser

Interactive tool

Convert Binary to Base64

Ready

Output format

Choose a clear output representation.

Detailed conversion guide

How to Convert Binary to Base64

Each set of eight binary digits represents one byte. The tool reads the bits from left to right, preserves every zero byte, and encodes the resulting byte sequence as Base64.

Paste bits or import a file to see its bytes as bits. A file is read as raw bytes in your browser, including files that cannot be decoded as text. The default is padded Base64; Base64url uses - and _ and removes padding.

InputOutputMeaning
01000001QQ==One byte for ASCII A
00000000AA==One zero byte
01000001 00000000 11111111QQD/Three original bytes

Encode Complete Binary Bytes in JavaScript

Read complete byte groups before calling btoa. Encoding the characters 0 and 1 directly would produce a different result.

const bits = input.replace(/\s+/g, "");
if (!/^(?:[01]{8})+$/.test(bits)) throw Error("Complete bytes required");
const raw = bits.match(/.{8}/g).map(byte =>
  String.fromCharCode(parseInt(byte, 2))).join("");
const encoded = btoa(raw);

Incomplete Bits and Binary File Limits

Only 0, 1 and whitespace are accepted in the bit field. The tool rejects a partial byte instead of guessing where to add zeros. Do not use 0b prefixes or comma separators.

The local file picker accepts nonempty files up to 64 KiB. Importing a text file encodes its stored bytes, not the numeric meaning of any characters inside it.

Related converters

Choose the conversion that matches the representation you have.

Advertisement

Sponsored link