Back to All Labs

Binary Playground

The language every computer speaks. Learn to read it.

Interactive companion to Issues 1-3

Number Converter
Unsigned (0 to 255)
Decimal
Binary
Hex
ASCII
128
64
32
16
8
4
2
1
0
0
0
0
0
0
0
0
Click bits or type a number above
Bitwise Operations
A = decimal
0
0
0
0
0
0
0
0
B = decimal
0
0
0
0
0
0
0
0
Result: A AND B
0
0
0
0
0
0
0
0
= 0
Why this matters

AND can check if a number is even: N AND 1. If the result is 0, the number is even! Try setting A to any number and B to 1.

Two's Complement

How computers represent negative numbers using only 0s and 1s.

Decimal (-128 to 127)
Number Line

Click anywhere on the line to see its binary representation.

Why -1 is 11111111: Start with 1 (00000001), flip all bits (11111110), add 1 = 11111111. Every bit is on because -1 + 1 = 0, and 11111111 + 00000001 overflows to 00000000.
Why -128 is 10000000: The highest bit (128) acts as the sign bit. With it set and all other bits 0, you get the most negative number: -128.
IEEE 754 Floating Point (32-bit)
Decimal
Sign (1 bit) Exponent (8 bits) Mantissa (23 bits)
Enter a number to see its IEEE 754 representation
The Famous 0.1 + 0.2 Problem

In JavaScript (and most languages):

0.1 + 0.2 =
0.1 in binary: 0.0001100110011... (repeating forever!)
0.2 in binary: 0.0011001100110... (also repeating!)
Neither 0.1 nor 0.2 can be exactly represented in binary,
so tiny rounding errors accumulate.
This is why your calculator sometimes shows 0.30000000000000004! It is not a bug in JavaScript, it is a fundamental limit of representing decimal fractions in binary floating point.
Printable ASCII Characters (32-126)

Hover for details. Click to load in the Converter tab.

The Case Bit Trick

Lowercase letters = uppercase + 32. That means they differ by exactly one bit (bit 5)!

A
65 = 01000001
vs
a
97 = 01100001
Flip bit 5 (value 32) to toggle between upper and lowercase. Computers use this trick for fast case-insensitive comparisons!
Binary Word Viewer

Type a word to see each letter as binary.

Type something above...