Measurement
Science & Engineering
Digital & Data
Everyday
Popular converters All converters Blog About

Number System Converter

Convert binary, decimal, hexadecimal & octal

Type a whole number in binary, octal, decimal or hexadecimal and see it in all four bases at once. For example, decimal 255 is 11111111 in binary, 377 in octal and FF in hex.

3 converters4 unitsUpdated

Convert to every base

Live
Complete list

All number system converters

Every number base and numeral converter on Panglify, grouped by the system you start from. Each page includes a live calculator, the method and worked examples.

3 converters
No number tool matches that. Try binary, hex, octal or Roman.

11 more number converters are on the way.

How do you convert between number bases?

To convert to decimal, multiply each digit by its place value and add the results; to convert from decimal, divide by the base repeatedly and read the remainders from last to first. Both rules work because in any positional system each place is worth a power of the base. In decimal the places are 1, 10, 100 and so on; in binary they are 1, 2, 4, 8, 16; in hexadecimal they are 1, 16, 256, 4,096.

Worked example: 156 to binary and back

Divide 156 by 2 and keep the remainders: 156 → 78 r0, 78 → 39 r0, 39 → 19 r1, 19 → 9 r1, 9 → 4 r1, 4 → 2 r0, 2 → 1 r0, 1 → 0 r1. Reading the remainders from bottom to top gives 10011100. To check, add the place values of the 1s: 128 + 16 + 8 + 4 = 156. The decimal to binary converter shows the same steps for any number, and the binary to decimal converter reverses them.

Quick rule: one hex digit is exactly 4 binary digits and one octal digit is exactly 3. Group bits from the right: 1001 1100 is 9C in hex, and 10 011 100 is 234 in octal.

Why hex and binary convert so easily

Because 16 is 2⁴, you never need decimal as a middle step between binary and hex. Replace each hex digit with its 4-bit pattern (F = 1111, 2 = 0010), or split a binary number into groups of four from the right. This is how programmers read memory dumps and bit masks at a glance.

Binary, octal and hex table: 0 to 16 and key values

The first 17 whole numbers in each base, followed by powers of two and byte boundaries that come up constantly in computing. Use the decimal to hex converter for larger values.

Binary, octal and hex table: 0 to 16 and key values
DecimalBinaryOctalHexadecimal
0000
1111
21022
31133
410044
510155
611066
711177
81000108
91001119
10101012A
11101113B
12110014C
13110115D
14111016E
15111117F
16100002010
321000004020
64100000010040
100110010014464
12711111111777F
1281000000020080
25511111111377FF
256100000000400100
1024100000000002000400

Common hex color codes in RGB and binary

A web color like #FFA500 is three hex bytes: red, green and blue, each from 00 to FF (0 to 255). Converting each pair from hex to decimal gives the RGB values; the hex to decimal converter does one pair at a time.

Common hex color codes in RGB and binary
CSS colorHexRGB (decimal)Binary (R G B)
White#FFFFFF255, 255, 25511111111 11111111 11111111
Black#0000000, 0, 000000000 00000000 00000000
Red#FF0000255, 0, 011111111 00000000 00000000
Lime#00FF000, 255, 000000000 11111111 00000000
Blue#0000FF0, 0, 25500000000 00000000 11111111
Yellow#FFFF00255, 255, 011111111 11111111 00000000
Gray#808080128, 128, 12810000000 10000000 10000000
Silver#C0C0C0192, 192, 19211000000 11000000 11000000
Orange#FFA500255, 165, 011111111 10100101 00000000
Purple#800080128, 0, 12810000000 00000000 10000000

Why do computers use binary?

Computers use binary because their circuits are built from switches with two reliable states, on and off, which map directly to 1 and 0. A transistor that only has to tell high voltage from low voltage can tolerate noise, heat and manufacturing variation far better than one that must separate ten levels, so two states make hardware cheaper, faster and more reliable.

Binary also suits logic. The operations AND, OR and NOT from Boolean algebra work on true and false values, and every arithmetic circuit, from an adder to a full processor, is built by combining them. Numbers, text, images and sound are all stored as patterns of bits: a character in ASCII is 7 bits, a pixel in a typical screen image is 24 bits (8 each for red, green and blue), and a sample in CD audio is 16 bits.

People find long rows of ones and zeros hard to read, which is why hexadecimal exists. Four bits map to exactly one hex digit, so a 24-bit color such as 11111111 10100101 00000000 is written #FFA500, a format defined for the web by the W3C CSS Color Module. To check any bit pattern by hand, the binary to decimal converter adds up the place values for you, and the digital and typography converter covers the pixel side of screen work.

Where is each number system used?

Decimal is the system people read, binary is the one hardware runs on, and hexadecimal and octal are compact shorthands programmers use to read binary. Each shows up in a predictable set of places.

  • Binary (base 2): the native language of digital hardware, used for bit flags, network subnet masks and logic design.
  • Octal (base 8): Unix and Linux file permissions, where chmod 755 gives the owner read, write and execute and everyone else read and execute (binary 111 101 101).
  • Decimal (base 10): everyday arithmetic, money and most user interfaces.
  • Hexadecimal (base 16): memory addresses, color codes, MAC addresses, Unicode code points such as U+00E9, and byte values in debuggers.
  • Roman numerals: clock faces, book chapters, film copyright years and event names. The numbers to Roman numerals converter turns 2026 into MMXXVI.

For file and memory sizes built on these bases, the data storage converter explains why 1 KiB is 1,024 bytes.

How are negative numbers stored in binary?

Computers store negative integers in two's complement, a signed format in which the highest bit carries a negative place value. To write a negative number, take the binary of its absolute value, flip every bit and add 1. In 8 bits, 5 is 00000101; flipping gives 11111010, and adding 1 gives 11111011, which is FB in hex. An 8-bit signed value ranges from −128 (10000000) to 127 (01111111), and −1 is all ones, 11111111 or FF.

This is why the same hex byte can mean two things: FF is 255 when read as unsigned and −1 when read as signed. The converter on this page treats input as an unsigned whole number, so enter the positive bit pattern when you want to see it in other bases.

How many values can a number of bits hold?

A group of n bits can represent 2ⁿ different values: 0 to 2ⁿ − 1 when unsigned, or −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1 in two's complement. A bit is one binary digit, and a byte is 8 bits, so one byte holds 256 values. Each extra bit doubles the range, which is why sizes in computing climb in powers of two.

WidthDistinct valuesUnsigned rangeMax in hexSigned rangeTypical use
4 bits160 to 150xF−8 to 7One hex digit (a nibble)
8 bits2560 to 2550xFF−128 to 127A byte; one RGB color channel
16 bits65,5360 to 65,5350xFFFF−32,768 to 32,767TCP/UDP port numbers; UTF-16 code units
32 bits4,294,967,2960 to 4,294,967,2950xFFFFFFFF−2,147,483,648 to 2,147,483,647IPv4 addresses; classic Unix time
64 bits18,446,744,073,709,551,6160 to 18,446,744,073,709,551,6150xFFFFFFFFFFFFFFFF−9,223,372,036,854,775,808 to 9,223,372,036,854,775,807Registers on 64-bit processors; 64-bit Unix time

The limits have real consequences. A signed 32-bit counter of seconds since January 1, 1970, the traditional Unix timestamp, overflows at 2,147,483,647 seconds, which falls on January 19, 2038 at 03:14:07 UTC. Systems that moved to 64-bit time avoid the problem for billions of years. Converting the maximum values is also a good check on your work: 65,535 in the decimal to binary converter gives sixteen ones, and the same number in the decimal to hex converter gives FFFF.

Storage sizes follow the same powers of two. The binary prefixes kibi, mebi and gibi, standardized in IEC 80000-13, mean 2¹⁰, 2²⁰ and 2³⁰ bytes, and the data storage converter sets them against the decimal kilobyte, megabyte and gigabyte.

Sources and further reading

The standards and references behind the numbers on this page. Links open in a new tab.

Standards and official sources

Further reading

Reference

Number bases and their digits

A positional number system gives each digit a value equal to the digit times a power of the base. The base decides how many digits the system uses before it carries into the next place.

Binary (Base 2)
digits 0–1
Octal (Base 8)
digits 0–7
Decimal (Base 10)
digits 0–9
Hexadecimal (Base 16)
digits 0–9, A–F

Notation: programming languages commonly mark binary with 0b, octal with 0o or a leading 0, and hexadecimal with 0x. Hex color codes follow the W3C CSS Color Module Level 4.

Questions

Number system FAQs

Quick, exact answers to the questions people ask most.

How do you convert binary to decimal?

Multiply each binary digit by its place value (1, 2, 4, 8, 16 and so on from the right) and add the results. For example, 1011 is 8 + 0 + 2 + 1 = 11.

How do you convert decimal to hexadecimal?

Divide the number by 16 repeatedly and write down the remainders, using A to F for 10 to 15, then read them from last to first. For example, 255 ÷ 16 = 15 remainder 15, so 255 is FF.

What is 255 in binary?

255 in binary is 11111111, eight ones. It is the largest value one byte can hold, and it is FF in hexadecimal and 377 in octal.

Why do programmers use hexadecimal?

Each hex digit represents exactly 4 bits, so one byte is always two hex digits. That makes long binary values much shorter and easier to read; for example, 11010110 becomes D6.

What does 0x mean before a number?

The 0x prefix marks a number as hexadecimal in languages such as C, Java, JavaScript and Python. So 0x2F means hex 2F, which is 47 in decimal.

What is 1000 in binary?

Decimal 1000 is 1111101000 in binary, 3E8 in hexadecimal and 1750 in octal.

How many bits are in a byte?

A byte is 8 bits, so it can hold 256 different values: 0 to 255 in decimal, or 00 to FF in hexadecimal. Half a byte, 4 bits, is called a nibble and matches exactly one hex digit.

What is the largest number a 32-bit integer can hold?

An unsigned 32-bit integer holds up to 4,294,967,295, which is FFFFFFFF in hex. A signed 32-bit integer in two's complement tops out at 2,147,483,647 and goes down to −2,147,483,648.

How do you convert hexadecimal to binary?

Replace each hex digit with its 4-bit pattern and join them. For example, hex 3E8 becomes 0011 1110 1000, which is 1111101000 once the leading zeros are dropped, or 1,000 in decimal.