Interactive Tool
Binary to Decimal Converter
Convert binary to decimal, decimal to binary, or either one to hex, and see the place values behind the answer. Switch to IP address to turn a dotted address into binary octet by octet.
- 4 ways to convert
- 64 bits at most
Convert a Number
| Binary (input) | 1010 1100 8 bits |
|---|---|
| Decimal | 172 |
| Hexadecimal | AC |
How it works
Place values
| Place | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|
| Bit | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 |
128 + 32 + 8 + 4 = 172
Ready to use it on masks? Open the subnet calculator
This binary to decimal converter works in both directions and shows how it got the answer. Pick what you’re converting from (binary, decimal, hex or an IP address), type the value, and the panel gives you the other forms along with the working: a place-value grid for binary, the subtraction or divide-by-2 method for decimal, and a bit grid for each octet of an address. It handles whole numbers up to 64 bits. If you’re studying for a networking exam, the working matters more than the answer, because that’s what you have to do on paper.
How to Convert Binary to Decimal
Binary is base 2. Each position is worth twice the one to its right, so reading from the right the places are 1, 2, 4, 8, 16, 32, 64 and 128 for an 8-bit number. A 1 in a position means “count this place,” and a 0 means “skip it.”
Take 10101100. Line it up under the eight place values:
- 128 has a 1, so count 128
- 64 has a 0
- 32 has a 1, so count 32
- 16 has a 0
- 8 has a 1, so count 8
- 4 has a 1, so count 4
- 2 and 1 both have a 0
Add the counted places: 128 + 32 + 8 + 4 = 172. The converter’s default example is this number, and its place-value grid highlights the four 1 bits.
Longer numbers work the same way. The places keep doubling (256, 512 and on up), and the converter lists the 1 bits as powers of two once a number passes 16 bits, so the grid stays readable.
How to Convert Decimal to Binary
There are two standard methods, and the converter uses the one that suits the number.
The subtraction method is the one to learn for networking, because every octet is between 0 and 255. Start at 128 and work down the place values. If the place fits in what’s left, write a 1 and subtract it; if not, write a 0 and move on. For 37: 128 doesn’t fit (0), 64 doesn’t fit (0), 32 fits (1, leaving 5), 16 doesn’t (0), 8 doesn’t (0), 4 fits (1, leaving 1), 2 doesn’t (0) and 1 fits (1, leaving 0). That gives 00100101. The converter shows this table for any decimal number up to 255.
The divide-by-2 method works for any size. Divide by 2, write the remainder, and repeat with the quotient until it reaches 0. Then read the remainders from the bottom up. For 37 the remainders are 1, 0, 1, 0, 0, 1, which read upward as 100101. Pad it to eight bits and you have the same 00100101. The converter switches to this method above 255.
Either way, check the answer by converting back: 32 + 4 + 1 = 37.
Converting an IP Address to Binary
An IPv4 address is a 32-bit number. RFC 791 defines the address as 32 bits, and the familiar dotted form splits those bits into four octets of eight, each written in decimal. To convert an address, convert each octet on its own and keep the dots.
For 192.168.10.37:
- 192 is 128 + 64, so 11000000
- 168 is 128 + 32 + 8, so 10101000
- 10 is 8 + 2, so 00001010
- 37 is 32 + 4 + 1, so 00100101
That makes the address 11000000.10101000.00001010.00100101. Every octet keeps all eight digits, leading zeros included, because each octet holds a fixed eight bits.
Choose IP address in the converter and it accepts either form. Type a dotted decimal address to get binary, or paste four dotted groups of 0s and 1s to get the decimal address back. It also shows the address as hex by octet and as a single 32-bit number, the form some logs and databases store.
Hexadecimal and Binary
Hexadecimal is base 16. It uses 0 to 9 and then A to F for 10 through 15. Each hex digit stands for exactly four bits, which is why people use it as shorthand for binary: one byte is always two hex digits. So 172 is AC in hex, because A is 1010 and C is 1100, and together they make 10101100.
You’ll see hex wherever there are a lot of bits to write down. IPv6 addresses are 128 bits, and RFC 4291 writes them as eight groups of up to four hex digits, each group standing for 16 bits. Converting hex to binary is a digit-by-digit swap, with no arithmetic needed. The converter shows that swap when you convert from hex, and the hex converter adds the powers of 16 and the divide-by-16 method.
Why Binary Matters for Subnetting
Subnetting is binary arithmetic with decimal labels. A subnet mask is a run of 1 bits followed by 0 bits, and the prefix length counts the 1s. A /27 mask is 27 ones and 5 zeros, which in dotted decimal is 255.255.255.224. The last octet, 11100000, is 128 + 64 + 32 = 224. Once you can read that octet as three network bits and five host bits, the rest follows: five host bits give 32 addresses, and 30 of them are usable.
That’s why the mask octet table below is worth memorizing. Every mask octet is one of nine values, and knowing their binary forms by sight is most of the speed in subnetting.
IPv4 subnetting is a listed objective on the CompTIA Network+ and Cisco CCNA exams. When you can convert an octet without stopping to think, take the next step with the subnetting practice problems, and use the subnet calculator to check a whole address and mask.
Subnet Mask Octets in Binary
The only values a subnet mask octet can take, because a mask's 1 bits run unbroken from the left. Generated from the same engine as the converter.
| Decimal | Binary | Hex | Network bits | Host bits |
|---|---|---|---|---|
| 0 | 00000000 | 00 | 0 | 8 |
| 128 | 10000000 | 80 | 1 | 7 |
| 192 | 11000000 | C0 | 2 | 6 |
| 224 | 11100000 | E0 | 3 | 5 |
| 240 | 11110000 | F0 | 4 | 4 |
| 248 | 11111000 | F8 | 5 | 3 |
| 252 | 11111100 | FC | 6 | 2 |
| 254 | 11111110 | FE | 7 | 1 |
| 255 | 11111111 | FF | 8 | 0 |
Powers of Two Table
The place values of binary: each one is double the last. The rows for 8, 16, 24 and 32 bits mark octet boundaries.
| Power | Value | Binary |
|---|---|---|
| 20 | 1 | 1 |
| 21 | 2 | 10 |
| 22 | 4 | 100 |
| 23 | 8 | 1000 |
| 24 | 16 | 10000 |
| 25 | 32 | 100000 |
| 26 | 64 | 1000000 |
| 27 | 128 | 10000000 |
| 28 | 256 | 100000000 |
| 29 | 512 | 1000000000 |
| 210 | 1,024 | 10000000000 |
| 211 | 2,048 | 100000000000 |
| 212 | 4,096 | 1000000000000 |
| 213 | 8,192 | 10000000000000 |
| 214 | 16,384 | 100000000000000 |
| 215 | 32,768 | 1000000000000000 |
| 216 | 65,536 | 10000000000000000 |
| 224 | 16,777,216 | 1000000000000000000000000 |
| 232 | 4,294,967,296 | 100000000000000000000000000000000 |
Binary Converter FAQ
How do you convert binary to decimal?
Write the place values over the bits, starting with 1 on the right and doubling each step to the left: 1, 2, 4, 8, 16 and so on. Add up the place values that sit over a 1 and skip the ones over a 0. For 10101100, that is 128 + 32 + 8 + 4 = 172.
What is 11111111 in decimal?
It is 255, the largest number eight bits can hold, because 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. That's why no octet of an IPv4 address goes above 255, and why a subnet mask octet of 255 means all eight bits belong to the network.
How many bits are in an IPv4 address?
Thirty-two. RFC 791 defines IPv4 addresses as 32 bits long, and the dotted form splits them into four 8-bit octets written in decimal. Choose IP address in the converter to see all 32 bits of any address.
Why does a subnet mask octet only take certain values?
A mask's 1 bits must run unbroken from the left, so an octet can only be some number of 1s followed by 0s. That leaves nine values: 0, 128, 192, 224, 240, 248, 252, 254 and 255. The table on this page lists each one in binary.
Does the converter save what I type?
No. The conversion runs in your browser and nothing you type is saved. When you press Convert or leave the field, your input is added to the page address so you can share the result, and like any page address it can appear in the site's analytics, as the privacy policy describes.
Keep researching