Binary, Decimal & Hexadecimal Converter (Free, with Steps)

Fractions & numbersFreeNo sign-up

A binary, decimal and hexadecimal converter rewrites a number in another base. To turn decimal into binary, divide by 2 again and again and read the remainders from the bottom up: 156 becomes 10011100. Group those bits in fours (1001 1100) and each group is one hex digit, so 156 = 9C in hexadecimal and 234 in octal.

Binary, decimal & hex converter
Digit groups

Whole numbers of any size are exact. Negatives (−) and a point (.) are allowed; 0x / 0b prefixes are ignored.
Try:
Answer in base 2 (binary)
1001 1100

156₁₀ = 1001 1100₂.
Binary (base 2)1001 1100
Octal (base 8)234
Decimal (base 10)156
Hexadecimal (base 16)9C
Bits needed (integer part)8
Bit grouping: binary, hex and octal side by side
10019
1100C
Each group of 4 bits is one hex digit (shown under it). Groups of 3 bits give octal: 010=2, 011=3, 100=4.
Method
Repeated division by 2
Show steps
  1. The number 156 is already in base 10, so we go straight to converting it to base 2.
  2. Whole part: divide by 2 again and again, writing down each remainder, until the quotient is 0.
    Division Quotient Remainder (digit)
    156 ÷ 2 78 0
    78 ÷ 2 39 0
    39 ÷ 2 19 1
    19 ÷ 2 9 1
    9 ÷ 2 4 1
    4 ÷ 2 2 0
    2 ÷ 2 1 0
    1 ÷ 2 0 1
  3. Read the remainders from the bottom up (last remainder first): 10011100.

Binary, Decimal & Hexadecimal Converter (Free, with Steps)
Embed this calculator on your site

Free to use on class pages, blogs and course pages. Copy the code below and paste it into your page:

How to use the converter

  1. Pick a tab: Convert (any base from 2 to 36), Two’s complement (signed numbers in 4 to 128 bits), Binary math (add, subtract, multiply or divide in binary) or Text ↔ binary.
  2. Type the number. In Convert, choose the base it is written in (From) and the base you want (To). Letters stand for digits above 9, so A = 10 and F = 15. Spaces, underscores and 0x or 0b prefixes are ignored.
  3. Read the answer, then binary, octal, decimal and hexadecimal side by side. Open Show steps for the full working.

Whole numbers of any length are converted exactly, including 64-bit and 128-bit values. A fraction such as 0.1 may never end in the new base, so the tool cuts it off after the number of fraction digits you choose and also shows the exact repeating pattern.

How base conversion works

In base b, each place is worth a power of b. Reading from the right, the places in binary are worth 1, 2, 4, 8, 16, and so on; in hexadecimal they are worth 1, 16, 256, 4,096. Every conversion uses two moves.

Any base to decimal: positional expansion

Multiply each digit by its place value and add. For hex 2F: 2 × 16 + 15 × 1 = 47. For binary 1011 0110: 128 + 32 + 16 + 4 + 2 = 182. After the point the places are 1/b, 1/b² and so on, so 101.101 in binary is 4 + 1 + 1/2 + 1/8 = 5.625.

Decimal to any base: repeated division

Divide by the new base and write down the remainder. Divide the quotient again until it reaches 0, then read the remainders from the last to the first. For 156 to binary the remainders are 0, 0, 1, 1, 1, 0, 0, 1, which read upward give 10011100.

For a fraction, multiply by the base instead. The whole-number part of each product is the next digit. For 0.625: 0.625 × 2 = 1.25 (digit 1), 0.25 × 2 = 0.5 (digit 0), 0.5 × 2 = 1 (digit 1), so 0.625 = 0.101 in binary. For 0.1 the products cycle forever, and 0.1 in binary is 0.0001100110011… This is why computers store 0.1 only approximately.

The shortcut between binary, octal and hex

Because 16 = 24 and 8 = 23, you do not need decimal in between. Split the bits into groups of 4 from the right for hex (1011 0110 → B6) or groups of 3 for octal (10 110 110 → 266). Going the other way, write each hex digit as 4 bits: 9C → 1001 1100.

Binary, decimal, octal and hex conversion chart

Decimal Binary Octal Hex
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
16 10000 20 10
32 100000 40 20
64 1000000 100 40
100 1100100 144 64
128 10000000 200 80
255 11111111 377 FF
256 100000000 400 100
1000 1111101000 1750 3E8
1024 10000000000 2000 400

Two’s complement for negative numbers

Computers store signed integers in a fixed number of bits using two’s complement. To write −45 in 8 bits, write 45 in binary (0010 1101), invert every bit (1101 0010) and add 1: 1101 0011. A quicker check: 28 − 45 = 211, and 211 in binary is 1101 0011.

To read a pattern back, look at the leftmost bit. If it is 1, the number is negative and that bit is worth −2n−1. For 1101 0011: −128 + 64 + 16 + 2 + 1 = −45. A signed n-bit number runs from −2n−1 to 2n−1 − 1, so 8 bits hold −128 to 127. The same bits read as unsigned are 211, which is why you should always say whether a value is signed.

Binary arithmetic with carries

Binary addition follows four rules: 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10 (write 0, carry 1) and 1 + 1 + 1 = 11 (write 1, carry 1). Adding 101101 and 1011 (45 + 11) gives 111000, which is 56. In subtraction, borrowing 1 from the next column gives 2 in the current one, so 10 − 1 = 1. Multiplication is shift-and-add: 1011 × 101 is 1011 + 101100 = 110111 (11 × 5 = 55). The Binary math tab draws the carries, borrows and partial products for your own numbers.

Text to binary (ASCII and UTF-8)

Each character has a code. In ASCII, “H” is 72 and “i” is 105, so “Hi” is 01001000 01101001, one 8-bit byte per letter. Characters outside ASCII, such as é or emoji, take 2 to 4 bytes in UTF-8, the encoding used by almost every web page. The Text tab shows the code point and the bytes for each character.

Common mistakes

Mistake Fix
Reading division remainders top-down Read them from the last remainder to the first: 6 → remainders 0, 1, 1 → 110.
Starting place values at 1 instead of b0 The rightmost place is always worth 1. In 1010, the places are 8, 4, 2, 1, so 1010 = 10.
Grouping bits from the left Group whole-number bits from the right (pad zeros on the left): 101110 → 10 1110 → 2E.
Using digits that do not exist Binary has only 0 and 1, octal 0 to 7, hex 0 to 9 and A to F.
Forgetting the bit width in two’s complement 1111 is −1 in 4 bits but 15 as an unsigned number and 0000 1111 in 8 bits.
Treating hex letters as separate numbers A to F are single digits worth 10 to 15, so 1A = 16 + 10 = 26, not 1 and 10.

Checking homework with the converter

Work the problem by hand first, then enter it and open the steps. Compare your division table or place-value sum row by row and find the first line that differs; that is the mistake to fix. Estimate before you trust any answer: a binary number with 8 digits is between 128 and 255, and each extra hex digit multiplies the size by 16.

Binary, decimal and hexadecimal practice quiz: 10 questions

Test yourself with 10 multiple-choice questions. Choose an answer and press Submit to see if you are right and why. Your score appears at the end.

Question 1 of 10
1. What is 25 in binary?

Found a mistake? Let us know!

2. What is the binary number 101101 in decimal?

Found a mistake? Let us know!

3. What is the hexadecimal number 3C in decimal?

Found a mistake? Let us know!

4. What is 255 in hexadecimal?

Found a mistake? Let us know!

5. Convert the binary number 1110 1011 to hexadecimal.

Found a mistake? Let us know!

6. What is 64 in octal?

Found a mistake? Let us know!

7. What is −6 in 8-bit two’s complement?

Found a mistake? Let us know!

8. What is the binary fraction 0.11 in decimal?

Found a mistake? Let us know!

9. What is 1011 + 111 in binary?

Found a mistake? Let us know!

10. In ASCII, the letter ‘A’ has code 65. What is ‘A’ as an 8-bit binary byte?

Found a mistake? Let us know!

Frequently asked questions

What are binary, decimal and hexadecimal?

They are number systems with different bases. Decimal (base 10) uses digits 0 to 9, binary (base 2) uses 0 and 1, and hexadecimal (base 16) uses 0 to 9 and A to F. Computers work in binary; programmers write binary as hex because one hex digit is exactly 4 bits.

How do you convert decimal to hexadecimal?

Divide by 16 repeatedly and read the remainders upward, writing 10 to 15 as A to F. For 470: 470 ÷ 16 = 29 remainder 6, 29 ÷ 16 = 1 remainder 13 (D), 1 ÷ 16 = 0 remainder 1, so 470 = 1D6.

Can binary be converted directly to hexadecimal?

Yes. Split the bits into groups of 4 from the right and replace each group with one hex digit: 1101 0110 is D6. No decimal step is needed.

How do you convert binary to decimal?

Add the place values of the 1 bits. For 110101: 32 + 16 + 4 + 1 = 53. Another way is to double as you read left to right: start at 0, double and add each bit.

How do you convert decimal to octal?

Divide by 8 repeatedly and read the remainders upward. For 100: 100 ÷ 8 = 12 remainder 4, 12 ÷ 8 = 1 remainder 4, 1 ÷ 8 = 0 remainder 1, so 100 = 144 in octal. From binary, group the bits in threes instead.

Related calculators

More fractions & numbers calculators

Browse all 206 calculators

Related to This Article

What people say about "Binary, Decimal and Hexadecimal Converter (Any Base, Steps)"?

No one replied yet.

Leave a Reply