Necessary cookies and storage support sign-in and learning. Optional Vercel analytics and campaign measurement stay off unless you accept. Rejecting won't affect courses or checkout.
Global Privacy Control is on. Optional analytics stays off.
FREE TOOL
Choose the base you are typing in and the width of the value, then enter it. The converter shows the same value in dotted decimal, binary, hexadecimal and as an unsigned decimal integer, with the working for each step. If you mark the value as a subnet mask, it also checks that the mask is a run of ones followed by zeros. The conversion runs in this page, and the page does not send what you enter to a server. No account is required.
This converter runs in your browser and needs JavaScript turned on. The boxes stay locked until the page script loads, so the page cannot send anything you enter. If they stay locked, the script did not load. Turn on JavaScript or reload the page to use the converter.
The converter is ready. It runs in this page, and the page does not send what you enter to a server.
Each step shows the value in binary, with the same value in decimal and, in parentheses, hexadecimal. Where a mask applies, its one bits are shown in bold.
The same digits mean different values in different bases. 10 is ten in decimal, two in binary and sixteen in hexadecimal, and 11000000 could be a binary octet or a decimal number in the millions. The converter does not guess. You choose the base, and you choose whether the value is a full 32-bit address or mask or a single 8-bit octet. A value that does not fit the width you chose is refused with the reason, rather than cut down to fit.
In binary and hexadecimal, zeros on the left do not change the value, so a shorter entry is padded on the left to fill the width, and the result says how many zeros were added. Binary may also be written as four groups of 8 digits separated by dots or spaces. Any other grouping is refused, because a short group would be ambiguous.
In decimal, whether a single integer or an octet in dotted decimal, a number that starts with 0 is refused. The POSIX inet_addr() function, which many programs use to read addresses, treats a leading 0 as octal, so it reads 010 as eight. RFC 6943 describes this "loose" syntax and contrasts it with inet_pton(), which accepts only plain decimal octets. Because the two readings disagree, the converter asks you to drop the zero.
An IPv4 address is 32 bits, so as one number it runs from 0 for 0.0.0.0 to 4,294,967,295 for 255.255.255.255. The first octet is worth 224, or 16,777,216, the second 65,536, the third 256 and the fourth 1. Some programs store an address in a signed 32-bit integer, where the leftmost bit is a sign, so every address from 128.0.0.0 upward appears as a negative number. Most of JavaScript's bitwise operators, for example, return signed 32-bit results. This converter keeps every value unsigned and never shows a negative number.
To practice, convert 172.16.10.1 to binary and to one unsigned integer on paper first. Then enter it here and compare your octets and your sum with the working.
When you mark the value as a subnet mask, the converter checks that its bits are a run of ones followed by a run of zeros, the same check the IPv4 subnet calculator applies to a mask. A valid mask also gets its prefix length and its wildcard, the bit-for-bit inverse. A value such as 255.0.255.0 is refused as a mask, because a 0 comes before a 1. For one octet, the valid mask values are 0, 128, 192, 224, 240, 248, 252, 254 and 255. When you mark the value as an address or number, it is only a number, and the converter says nothing about masks.
The converter handles 32-bit IPv4 values and single 8-bit octets. It does not convert IPv6 addresses, and it does not accept the shortened or octal forms that inet_addr() allows, such as 10.0.258 or 012.0.0.1. It converts the number you enter and does not say whether the address is assigned, reserved or reachable.
Sources: RFC 6943, section 3.1.1, IPv4 literals; POSIX inet_addr(); ECMAScript, ToInt32, for signed results from most of JavaScript's bitwise operators.