TR

Home / Guides / Binary, Decimal and Hexadecimal Number Systems: Methods for Converting Between Bases

Binary, Decimal and Hexadecimal Number Systems: Methods for Converting Between Bases

Updated: November 6, 2026 · AracMerkezi

▶ Open Number Base Converter (Binary, Decimal, Hex)

In everyday life we write numbers in the decimal system: ten digits, 0 through 9. Computers work in the binary system, based on a signal being on or off, and programmers also use octal and hexadecimal systems alongside it. In this article you will get to know the four systems, learn two practical methods of converting between them by hand with examples, and see where mistakes are made.

Four systems, one logic

They all rest on the same rule: each digit of a number carries a value multiplied by a power of the base. In decimal, 345 = 3×10² + 4×10¹ + 5×10⁰. In binary the powers are powers of 2, and in hexadecimal powers of 16.

SystemBaseDigits used
Binary20, 1
Octal80-7
Decimal100-9
Hexadecimal160-9 and A-F

In hexadecimal, A=10, B=11, C=12, D=13, E=14, F=15. If it is not clear which base a number is written in, confusion follows: 101 is one hundred one in decimal, five in binary and 257 in hexadecimal. That is why software uses prefixes: 0b101, 0o755, 0x41.

Method 1: Binary to decimal

Each bit is multiplied by the power of 2 at its position and the results are added. Starting from the right, the positions run 1, 2, 4, 8, 16, 32.

Example: the number 101101. 1×32 + 0×16 + 1×8 + 1×4 + 0×2 + 1×1 = 32 + 8 + 4 + 1 = 45.

Method 2: Decimal to binary (repeated division)

Divide the number by 2 and write down the remainder, divide the quotient again, stop when the quotient is 0, and read the remainders from last to first.

Example: 203. 203/2 = 101 remainder 1; 101/2 = 50 remainder 1; 50/2 = 25 remainder 0; 25/2 = 12 remainder 1; 12/2 = 6 remainder 0; 6/2 = 3 remainder 0; 3/2 = 1 remainder 1; 1/2 = 0 remainder 1. Read from last to first: 11001011. Check: 128+64+8+2+1 = 203.

Method 3: Grouping in fours for hexadecimal

Four bits correspond to exactly one hexadecimal digit. Split the binary number into groups of four starting from the right and convert each group.

Example: 110101111010. Groups: 1101 | 0111 | 1010. 1101 = 13 = D, 0111 = 7, 1010 = 10 = A. The result is D7A. Its decimal value is 3,450. In reverse, for 3F8 expand each digit into four bits: 0011 | 1111 | 1000. Its decimal value is 3×256 + 15×16 + 8 = 1,016.

In octal the same method works with groups of three: 755 = 111 | 101 | 101. This is why file permissions use octal numbers; for details see the Chmod Calculator.

Equivalents of small numbers

DecimalBinaryHexadecimal
000000
501015
101010A
151111F
161000010
25511111111FF

Bit count and the largest value

With n bits you can represent numbers from 0 to 2ⁿ − 1. This is the source of overflow errors.

BitsLargest unsigned numberExample use
8255One color channel, one byte
1665,535Port numbers
324,294,967,295A whole IPv4 address

Text and color examples

The code of capital A is 65: 01000001 in binary, 41 in hexadecimal. Lowercase a is 97 (01100001). The Unicode and Binary Code Converter helps you see the byte equivalents of characters.

The color code #0B7A6B is three bytes: red 0B = 11, green 7A = 122, blue 6B = 107. For a detailed conversion you can use the HEX RGB guide and the Color Code Converter. The same logic appears in IP addresses: since 255 = 11111111, the last part of the subnet mask 255.255.255.192 is 11000000; you can see this in the IP address and CIDR guide.

Example: Verifying the number 172 in two ways

Finding a result by two independent routes is the most reliable way to catch an error. Take 172. By division: 172/2 = 86 r0; 86/2 = 43 r0; 43/2 = 21 r1; 21/2 = 10 r1; 10/2 = 5 r0; 5/2 = 2 r1; 2/2 = 1 r0; 1/2 = 0 r1. From last to first: 10101100. By the hexadecimal route: 172/16 = 10 remainder 12; 10 = A, 12 = C, so AC. If you expand AC into fours, A = 1010 and C = 1100, and you arrive at 10101100. If both routes give the same bits, the conversion is right. This number is the first part of the 172.16.0.0/12 private network range, which is why network engineers know its binary form by heart.

Which system is used where?

Decimal is preferred for values people will read (prices, quantities, age). Binary is useful when thinking about hardware and bit operations, for example to see which flag is on. Octal is the natural notation for groups of three bits such as Unix file permissions. Hexadecimal, because it lines up with byte boundaries, is common in color codes, memory addresses, debuggers and network devices. In the end, the right system depends on how the information is divided: hexadecimal suits pieces of 8, octal suits pieces of 3.

Why hexadecimal?

One byte (8 bits) is two hexadecimal digits: 11111111 = FF = 255. Long binary strings are hard to read and error-prone; hexadecimal writes the same information four times shorter. Memory addresses, error codes and colors are written in hexadecimal for this reason.

Common mistakes

Mini glossary

To check a conversion quickly, use the Number Base Converter, and for the byte equivalents of text use the Unicode and Binary Code Converter. Comparing the result you found by hand with the tool is the best way to cement the method.

Frequently asked questions

What is 255 in binary?

11111111; in hexadecimal it is FF. It is the largest unsigned number that fits in 8 bits.

What does A equal in hexadecimal?

10; A=10, B=11, C=12, D=13, E=14, F=15.

How do I convert a binary number to hexadecimal?

Split it into groups of four starting from the right and convert each group to one hexadecimal digit. For example, 1101 0111 1010 = D7A.

Tools mentioned in this guide

More guides

This article is for general information only and is not legal, financial or medical advice. We are not an official institution.