Instantly convert between decimal and binary — the foundation of every CS course, networking exam, and bitwise operation in code.

Binary (base-2) is the fundamental number system of computers. Every piece of data — text, images, programs — is stored as sequences of 0s and 1s. Understanding binary is essential for programming, networking, and computer science.
Each binary digit (bit) represents a power of 2: ...128, 64, 32, 16, 8, 4, 2, 1. For example: decimal 42 = binary 101010 (32+8+2).
Common uses: IP addresses, subnet masks, bitwise operations, permissions (chmod), and understanding how computers store numbers.
All calculations run locally in your browser — nothing is sent to any server.
Repeatedly divide by 2 and record remainders. Read remainders bottom-to-top. Example: 42 ÷ 2 = 21 R0, 21 ÷ 2 = 10 R1, 10 ÷ 2 = 5 R0, 5 ÷ 2 = 2 R1, 2 ÷ 2 = 1 R0, 1 ÷ 2 = 0 R1 → 101010.
To convert binary to decimal: multiply each bit by its position value. 101010 = 1×32 + 0×16 + 1×8 + 0×4 + 1×2 + 0×1 = 42.
8 bits = 1 byte = values 0–255. 16 bits = values 0–65,535. 32 bits = values 0–4,294,967,295.
| Feature | Decimal (base-10) | Binary (base-2) |
|---|---|---|
| Digits | 0–9 | 0–1 |
| Used by | Humans | Computers |
| Example: 42 | 42 | 101010 |
| Example: 255 | 255 | 11111111 |
| Readability | Easy for humans | Long but computer-native |
Decimal 10 = binary 1010 (8+2). The CS50 Week 0 lecture uses exactly this example to introduce binary. In Python: bin(10) returns '0b1010'. In JavaScript: (10).toString(2) returns '1010'.
255 = 11111111 in binary — eight 1s, which is the maximum value of one byte (8 bits). It appears everywhere: the max RGB color channel value (rgb(255,255,255) = white), the max value of an unsigned char in C, and the broadcast subnet in IP networking.
1024 = 10000000000 in binary. It is exactly 2^10 — one 1 followed by ten 0s. This is why 1 KiB = 1,024 bytes and why computer memory comes in powers of 2 (512 MB, 1 GB, 2 GB, etc.).
Computers use two's complement to represent negative integers. For 8-bit: -1 = 11111111, -42 = 11010110. The rule: flip all bits, then add 1. JavaScript's bitwise operators work on 32-bit two's complement integers, so -1 | 0 equals 11111111111111111111111111111111.
Binary flags store multiple boolean states in a single integer. For example, in a permissions system: READ = 1 (001), WRITE = 2 (010), EXECUTE = 4 (100). Combining them with OR: READ | WRITE = 3 (011). Checking with AND: (perms & WRITE) !== 0 means write access is granted.
IPv4 addresses are 32-bit binary numbers. The subnet mask 255.255.255.0 in binary is 11111111.11111111.11111111.00000000. The /24 CIDR notation counts the leading 1s. Understanding this is required for the CCNA exam and for manually calculating host ranges.
chmod 777 = 111 111 111 in binary — three groups of rwx (read, write, execute) for owner, group, and others. 7 in decimal is 111 in binary, meaning all three permission bits are set. chmod 644 = 110 100 100 = rw-r--r-- (owner can read/write, others can only read).
Yes. All calculations run in your browser. No data is sent to any server.

Have an idea, found a bug, or want to suggest a feature? Drop us a message – we respond within 24 hours.