Conversions

Number Base Converter

Type a number, choose the base it is written in and the target base. You get the result, the work behind it and the four most-used bases side by side.

Calculator
Use letters A to Z for digits above 9 (A = 10, B = 11...). A minus sign and prefixes such as 0x and 0b are accepted.

Educational use: results are estimates made for study and reference. Checking the answer and deciding what to do with it is the sole responsibility of whoever uses the tool. Read the legal notice.

On this page
  1. How to use the converter
  2. Why we count by tens (and machines count by twos)
  3. The logic of positional systems
  4. The hexadecimal shortcut
  5. Solved examples
  6. Tables to memorize (or look up)
  7. What the tool covers
  8. Where these numbers show up
  9. Common stumbling blocks
  10. Questions from people who are learning
  11. Fun facts about bases
  12. Number system terms
  13. See also

How to use the converter

  1. Type the number. In bases above 10, use letters: in hexadecimal, A is 10, B is 11 and so on up to F, which is 15. Uppercase or lowercase makes no difference.
  2. Choose the starting base, which is the one the number is written in, and the target base, the one you want to convert to.
  3. Click Calculate. The result appears highlighted, the step-by-step work shows the positional sum and the successive divisions, and the list below gives the same number in binary, octal, decimal and hexadecimal.

If you see a message saying that a digit does not exist in the base, the number contains a symbol outside that base's alphabet. Binary has only 0 and 1, and octal goes from 0 to 7. A "2" in binary or a "9" in octal is impossible.

Why we count by tens (and machines count by twos)

We count in base 10 probably because of the ten fingers on our hands. But humanity has used other bases: the Babylonians used base 60, a legacy that lives on in our clocks (60 minutes, 60 seconds) and in angles (360°). The Maya used base 20.

The binary system was studied systematically by Gottfried Leibniz, who published a paper on binary arithmetic in 1703 and saw it as an elegant way to express numbers and logic. Almost 250 years later, it became the foundation of digital computers, for a practical reason: electronic circuits easily tell two states apart (on and off, high and low voltage), and it is much harder to do that reliably with ten levels.

The logic of positional systems

In any positional system, the value of a digit depends on the position it sits in. In base 10, the number 347 means:

3 × 10² + 4 × 10¹ + 7 × 10⁰ = 300 + 40 + 7each position is worth a power of 10

In another base b, the idea is the same, with 10 replaced by b:

value = Σ ( digit × bᵖᵒˢⁱᵗⁱᵒⁿ )position counts from right to left, starting at 0

From any base to decimal: positional sum

Multiply each digit by the power of the base that matches its position and add them up. The binary number 1011 is worth 1×8 + 0×4 + 1×2 + 1×1 = 11.

From decimal to any base: successive division

Divide the number by the target base and write down the remainder. Repeat with the quotient until you reach zero. The result is the remainders read from bottom to top. For example, 13 to binary:

13 ÷ 2 = 6, remainder 1
6 ÷ 2 = 3, remainder 0
3 ÷ 2 = 1, remainder 1
1 ÷ 2 = 0, remainder 1reading from bottom to top: 1101

To go from any base to any other, the tool uses decimal as a bridge, exactly as in the unit converter.

The hexadecimal shortcut

Each hexadecimal digit corresponds to exactly four bits. That is why programmers love hexadecimal: it is a compact way to write binary. To convert, just split the binary number into groups of four.

1111 1111 F F
The byte 1111 1111 in binary is FF in hexadecimal, and is worth 255 in decimal. Each group of 4 bits becomes one hexadecimal digit.

Solved examples

1. 255 in hexadecimal

255 ÷ 16 = 15, remainder 15 (F) 15 ÷ 16 = 0, remainder 15 (F) reading from bottom to top: FF

2. Binary 1010 to decimal

1×2³ + 0×2² + 1×2¹ + 0×2⁰ = 8 + 0 + 2 + 0 = 10

3. A web color

The color #FF8800 uses three hexadecimal pairs for red, green and blue.

FF = 255 · 88 = 8×16 + 8 = 136 · 00 = 0 RGB = (255, 136, 0): a strong orange

4. File permissions (octal)

On Unix systems, the number 755 is octal. Each digit represents three permission bits.

7 = 111 (read, write, execute) 5 = 101 (read, execute) 755 = 111 101 101

5. 100 in binary

100 ÷ 2 = 50 r0 · 50 ÷ 2 = 25 r0 · 25 ÷ 2 = 12 r1 12 ÷ 2 = 6 r0 · 6 ÷ 2 = 3 r0 · 3 ÷ 2 = 1 r1 · 1 ÷ 2 = 0 r1 reading from bottom to top: 1100100

Tables to memorize (or look up)

From 0 to 16 in four bases

DecimalBinaryOctalHexadecimal
0000
1111
21022
31133
410044
510155
611066
711177
81000108
91001119
10101012A
11101113B
12110014C
13110115D
14111016E
15111117F
16100002010

Powers of 2

ExponentValueExponentValue
2⁰12⁶64
2¹22⁷128
2²42⁸256
2³82¹⁰1,024
2⁴162¹⁶65,536
2⁵322³²4,294,967,296

What the tool covers

The tool converts whole numbers (positive or negative) of up to 200 digits, using arbitrary-precision arithmetic. It does not convert fractional numbers (with a decimal point) and does not use representations such as two's complement, floating point or character encodings. Negative numbers are shown with a minus sign, not the way they would be stored in a computer's memory.

For exams, assignments and projects, check that the representation you are asked for (for example, "8-bit signed") is the same one the tool uses. Whoever uses the result is responsible for it.

Bottom line: this tool is educational. Results do not replace your own checking, and how you use them is entirely your responsibility. More details in the legal notice.

Where these numbers show up

  • Programming: bit masks, memory addresses, character values and colors.
  • Networking: IP addresses and subnet masks (in binary) and MAC addresses (in hexadecimal).
  • Web design: colors in hexadecimal, such as #2250F2.
  • Digital electronics: logic gates, registers and microcontrollers.
  • Operating systems: file permissions in octal (chmod 644, 755).
  • Math and exams: changing base is a classic logical reasoning topic.

Common stumbling blocks

Using digits the base does not have

In binary there are only 0 and 1. In octal, 0 to 7. An "8" or a "9" in octal is a typo or a misunderstanding, and the tool warns you.

Reading the remainders in the wrong order

In successive division, the first remainder is the least significant digit (the rightmost one). The result is read from bottom to top.

Mixing up "10" in different bases

"10" in binary is 2, in octal it is 8 and in hexadecimal it is 16. Always make clear which base a number is written in.

Forgetting leading zeros

In many applications, the length matters: 5 in 8-bit binary is 00000101. This tool shows the value without unnecessary zeros, and you can pad them yourself.

Thinking hexadecimal is a "different kind" of number

It is not: it is just another way of writing the same numbers. F0 and 240 are the same value.

Questions from people who are learning

How do I convert decimal to binary?

Divide the number by 2 repeatedly and write down the remainders. Reading them from bottom to top gives you the number in binary. 13 becomes 1101.

How do I convert binary to decimal?

Multiply each digit by a power of 2 according to its position (from right to left, starting at 2⁰) and add them up. 1011 = 8 + 2 + 1 = 11.

What do the letters in hexadecimal mean?

They are the digits above 9: A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15.

Why do computers use binary?

Because electronic circuits are very good at telling two states apart (on/off), which makes binary simple and reliable.

Why do programmers use hexadecimal?

Because each hexadecimal digit represents exactly 4 bits, which makes long binary numbers much shorter and easier to read.

What is the largest number with 8 bits?

255 (11111111 in binary, FF in hexadecimal). With 8 bits there are 256 combinations, from 0 to 255.

How do I convert binary to hexadecimal quickly?

Split the binary number into groups of 4 bits, from right to left, and replace each group with the matching hexadecimal digit. 1101 0110 becomes D6.

Does the tool accept numbers with a decimal point?

No, only whole numbers. Converting fractions between bases uses successive multiplication, and it is outside the scope of this tool.

Does the tool work with negative numbers?

Yes, with a minus sign before the number (for example, −10). The result also comes with a sign, not in two's complement.

What is base 36?

A system with 36 symbols: the digits 0 to 9 and the letters A to Z. It is used to represent large numbers with few characters.

Fun facts about bases

  • "Hexa" plus "decimal." The name mixes Greek (six) and Latin (ten), which add up to 16. Some find the mix annoying, others funny.
  • Halloween equals Christmas. A classic programmer joke: OCT 31 = DEC 25, because 31 in octal (OCT) is worth 25 in decimal (DEC).
  • Base 36 uses all the digits and all the letters of the alphabet, and is used to shorten identifiers, such as the short codes in links.
  • One byte (8 bits) can represent 256 values, from 0 to 255, which is why each RGB color component goes up to 255.

Number system terms

Base
The number of different symbols in a numbering system. Base 10 has ten (0 to 9), base 2 has two (0 and 1).
Bit
A binary digit: 0 or 1. The smallest unit of information.
Byte
A group of 8 bits. It represents 256 values (0 to 255).
Nibble
Half a byte: a group of 4 bits, represented by one hexadecimal digit.
Hexadecimal
A base-16 system, with digits 0 to 9 and letters A to F.
Positional system
A system in which the value of a digit depends on the position it sits in.
Most significant digit
The leftmost digit, the one with the greatest weight in the value.

See also