Convert decimal to binary – base-10 to base-2
Instantly convert between decimal and binary — the foundation of every CS course, networking exam, and bitwise operation in code.
When do you need to convert decimal to binary?
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.

How does decimal to binary conversion work?
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.
Decimal vs Binary
| 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 |
How to use the converter?
1. Enter a value
Type a whole number in the input field. The converter drops anything after the decimal point, so 13.5 gives the same result as 13.2. Read the result
The conversion result appears instantly in the field next to it – no clicking required.3. Copy or reverse
Click Copy result or use the Reverse button to convert in the opposite direction.
When is this converter useful?
Bitwise Operations in Code
JavaScript uses bitwise operators (&, |, ^, ~, <<, >>) directly on binary representations. Python's bin() function converts to binary. Knowing that 42 in binary is 101010 lets you predict bitwise AND, OR, and XOR results without running code first.Networking and Subnets
Subnet masks are binary patterns. The /24 CIDR notation means 24 consecutive 1s: 11111111.11111111.11111111.00000000 = 255.255.255.0. Understanding binary is required for networking certifications like CompTIA Network+ and CCNA.Unix Permissions (chmod)
Linux file permissions are three 3-bit fields. chmod 755 = rwxr-xr-x = 111 101 101 in binary. Each digit (7, 5, 5) is a decimal number that maps directly to a 3-bit binary group for owner, group, and others.CS Education (CS50, Khan Academy)
Harvard's CS50 teaches binary in week 0. Khan Academy's Computing course covers it in depth. Binary is also a core topic in CompTIA A+ and every high school AP Computer Science A exam. This converter is useful for homework verification.
Practical tips
- Powers of 2: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024.
- 1 byte = 8 bits = 0–255. Common in RGB colors, ASCII codes.
- IP address: 192.168.1.1 = 11000000.10101000.00000001.00000001.
- Negative numbers use two's complement in most systems.

Convert Decimal to other units
Content last reviewed: · written and checked by the Arteon team
Frequently asked questions
What is 10 in binary?
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'.
What is 255 in binary?
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.
What is 1024 in binary?
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.).
How do I convert negative numbers to binary?
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.
How are binary flags used in programming?
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.
How does binary relate to networking subnets?
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.
Why does chmod 777 give full permissions?
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).
Are calculations done locally?
Yes. All calculations run in your browser. No data is sent to any server.
How do I convert binary to decimal by hand?
Multiply each digit by its matching power of 2 and add the results. Example: 1101 is 1×8 + 1×4 + 0×2 + 1×1, that is 8 + 4 + 0 + 1, so 13. The converter does this instantly.
What is a bit and what is a byte?
A bit is a single binary digit, 0 or 1. A byte holds 8 bits and covers the values from 0 (00000000) to 255 (11111111). In memory, every piece of data is stored as a sequence of bits.
How do the AND and OR operations work?
AND returns 1 only when both bits are 1: 1100 AND 1010 gives 1000. OR returns 1 as soon as either bit is 1: 1100 OR 1010 gives 1110. Both sit behind flags, filters and masks in every language.
How many bits do IPv4 and IPv6 addresses have?
IPv4 has 32 bits, four octets of 8 bits each, for example 192.168.1.1. IPv6 has 128 bits split into eight groups of 16 bits written in hexadecimal, which covers 2 to the power of 128 addresses.
What does the 0b prefix mean in code?
The 0b prefix, a zero followed by the letter b, marks the number that follows as binary: 0b1101 is 13 in decimal. C, C++, Java, JavaScript, Python and most current languages accept it.
Where is the binary system taught?
Number systems appear in the first year of computer science degrees and in vocational IT courses worldwide, alongside networking modules. Subnet masks, bitwise operations and two’s complement are standard exam topics.

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