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.

to
ADVERTISEMENT

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

FeatureDecimal (base-10)Binary (base-2)
Digits0–90–1
Used byHumansComputers
Example: 4242101010
Example: 25525511111111
ReadabilityEasy for humansLong but computer-native
ADVERTISEMENT

How to use the converter?

  1. 1. Enter a value

    Type a number in the input field. You can use a period or comma as the decimal separator.
  2. 2. Read the result

    The conversion result appears instantly in the field next to it – no clicking required.
  3. 3. Copy or reverse

    Click Copy result or use the Reverse button to convert in the opposite direction.

When is this converter useful?

  1. 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.
  2. 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.
  3. 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.
  4. 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.
ADVERTISEMENT

Convert Decimal to other units

Explore other unit converters

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.

Decimal to binary number converter – Arteon

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.