Tools

Home
JSON FormatterSQL FormatterJS ValidatorMinify CSS
Merge PDFCompress PDFImage to PDF
JPG to PNGPNG to WebPCrop Image

Binary to Base64 Encoder

Convert binary strings (0s and 1s) to Base64 encoding and back. Supports space-separated bytes with auto-padding.

Your files never leave your browser
Binary Input0 bits, 0 bytes
Base64 Output0 chars
Ready·

Drop your binary string in, get valid Base64 out — or swap direction and decode Base64 back to raw bits. Spaces between bytes are handled automatically, and incomplete bit groups get zero-padded so you don't have to worry about counting to eight.

Works both ways in a single click, with no signup or rate limits. And everything runs in your browser. Nothing gets uploaded.

How It Works

Binary String
→
Group into Bytes
→
Base64 Encode

The converter strips spaces from your input, splits the 0s and 1s into 8-bit chunks, and converts each chunk to its byte value. Those bytes then run through the standard Base64 encoding — every 3 bytes become 4 ASCII characters from the Base64 alphabet. If the byte count isn't divisible by 3, padding (=) fills the gap.

Examples

Encoding "Hello" to Base64

The classic test string, typed out as binary bytes with spaces.

INPUT
01001000 01100101 01101100 01101100 01101111
OUTPUT
SGVsbG8=

Short binary — just two ASCII characters

Encoding "OK" (79, 75). Quick sanity check when you want to verify your bit ordering is correct.

INPUT
01001111 01001011
OUTPUT
T0s=

Decoding a Base64 token back to binary

Flip the direction and paste Base64 on the left. Useful when you're inspecting an API response or data URI and want to see the raw bits.

INPUT
AQID
OUTPUT
00000001 00000010 00000011

Who Uses This

👨‍💻 Developers

Embed small binary payloads as Base64 strings inside JSON configs or data URIs.

🔒 Security Analysts

Decode suspicious Base64 blobs back to raw bits during malware triage.

🎓 CS Students

Check homework answers — type the binary, see if your hand-calculated Base64 matches.

📡 IoT Engineers

Convert sensor register dumps to Base64 for transport over MQTT or HTTP.

Common Mistakes

Pasting hex digits instead of binary

Characters like A–F aren't valid here. If your data is in hex, convert hex → binary first (each hex digit = 4 bits), then paste the 0s and 1s.

Forgetting the direction is still set to decode

After hitting Swap to decode Base64, the mode stays reversed until you swap back. If your next paste is binary and the output looks wrong, check the direction label at the top of each panel.

Expecting UTF-8 text from arbitrary binary

Base64 encodes raw bytes, not text. If the binary doesn't represent valid UTF-8 code points, the decoded result will look like garbage. That is correct behavior — the bytes just aren't text.

Technical Details

Frequently Asked Questions

What is binary to Base64 conversion?

It takes a string of 0s and 1s, groups them into 8-bit bytes, and re-encodes those bytes using the 64-character Base64 alphabet (A–Z, a–z, 0–9, +, /). The result is safe to drop into JSON, emails, or data URIs without worrying about special characters breaking things.

How does padding work when my binary isn't a full byte?

If your bit string length isn't a multiple of 8, the last group gets leading zeros added until it forms a complete byte. So 1101 becomes 00001101. After that, normal Base64 padding (=) is applied if the total byte count isn't divisible by 3.

Can I decode Base64 back to binary with this tool?

Yes. Click the Swap button and the direction flips. Paste your Base64 on the left, and the binary representation appears on the right. You can toggle "Group output" to add spaces between each 8-bit byte for readability.

Is there a size limit on the input?

No hard limit. The tool processes everything in-browser, so it depends on how much memory your device has. In practice, strings up to about a million characters convert without issues. Beyond that your tab might slow down.

Is my data sent to a server?

No. Everything happens locally in JavaScript. You can disconnect from the internet after loading the page and the converter still works. Nothing is logged, stored, or transmitted.

Share: