Developer and Text Tools

How to Convert Between Binary, Decimal, Octal and Hexadecimal

Learn how number bases work and how to convert between binary, octal, decimal and hexadecimal by hand, with examples such as 255 and 2026.

Saizul Amin
Saizul Amin10 Oct 2026 · 3 min read
How to Convert Between Binary, Decimal, Octal and Hexadecimal

Computers store everything as binary, programmers read it as hexadecimal and people think in decimal. Moving between these number systems is a basic skill in computing, electronics and networking. The free Number Base Converter converts instantly and handles very large numbers. This guide shows how to do it by hand.

Quick answer

The decimal number 255 is 11111111 in binary, 377 in octal and FF in hexadecimal. The number 2026 is 11111101010 in binary and 7EA in hexadecimal.

The Number Base Converter on shobfree.com showing a number in binary, octal, decimal and hexadecimal The Number Base Converter showing one number in several bases.

What is a base?

The base, or radix, is how many different digits a system uses before it carries to the next place.

SystemBaseDigitsCommon use
Binary20 1Computers, logic
Octal80 to 7Unix file permissions
Decimal100 to 9Everyday counting
Hexadecimal160 to 9, A to FColours, memory, MAC addresses

In hexadecimal, A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15.

Binary to decimal

Each position is a power of 2, counting from the right starting at 1, 2, 4, 8, 16 and so on. For 1101:

1 x 8 + 1 x 4 + 0 x 2 + 1 x 1 = 13.

Decimal to binary

Divide by 2 repeatedly and write the remainders from the bottom up. For 13:

  • 13 / 2 = 6 remainder 1
  • 6 / 2 = 3 remainder 0
  • 3 / 2 = 1 remainder 1
  • 1 / 2 = 0 remainder 1

Reading from the last remainder to the first: 1101.

Hexadecimal shortcuts

One hexadecimal digit equals exactly four binary digits, which is why hex is used as a compact way of writing binary.

HexBinaryHexBinary
0000081000
1000191001
20010A1010
30011B1011
40100C1100
50101D1101
60110E1110
70111F1111

To convert 7EA to binary, write each digit as four bits: 0111 1110 1010, which is 11111101010 once the leading zero is dropped.

Where you will meet other bases

  • Colours on the web: #2563EB is three hexadecimal bytes for red, green and blue. See the Color Converter.
  • IP and MAC addresses, and memory addresses in debugging.
  • Unix permissions: chmod 755 is octal.
  • Character codes: the letter A is 65 decimal, 41 in hex. See the ASCII Table.

Tips

  1. Group binary digits in fours from the right when converting to hex.
  2. Remember powers of two: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024.
  3. Write the base as a subscript or prefix to avoid confusion: 0x for hex, 0b for binary.
  4. Use the converter to check your work, not to replace the practice.

Frequently asked questions

Why does hexadecimal use letters? Because it needs 16 symbols, and digits only go to 9.

What is the largest value in a byte? 255, which is FF in hex or 11111111 in binary.

Does the converter accept negative numbers? Yes, put a minus sign in front.

Next step

Convert your own number with the Number Base Converter. For text and encodings, try the Base64 Text Converter.

Completely freeNo cost, no sign-up
Files stay privateDeleted automatically after the job
Easy in BanglaIn both Bangla and English