Binary Converter

Home › Conversion › Number conversion › Decimal to binary

Decimal to Binary Converter

Binary result
Binary number
-
Binary number
Binary signed 2's complement
Hex number

Decimal

Decimal is the number system we use every day. It has ten digits, 0 to 9, and each place is worth ten times the place to its right. In 677, the 6 stands for 600, the 7 in the tens place for 70 and the last 7 for 7.

Binary

Binary has only two digits, 0 and 1, and each place is worth twice the place to its right. The places are 1, 2, 4, 8, 16, 32, 64, 128 and so on. So 1010 means 8 + 2, which is 10 in decimal. Computers use binary because digital circuits have two dependable states, off and on.

How to convert decimal to binary

  1. Divide the decimal number by 2.
  2. Write down the remainder (0 or 1) as the next binary digit.
  3. Replace the number with the quotient and repeat until the quotient is 0.
  4. Read the remainders from the last one to the first. That is the binary number.

Example: convert 125 to binary

Division by 2QuotientRemainderBit #
125 ÷ 26210 (LSB)
62 ÷ 23101
31 ÷ 21512
15 ÷ 2713
7 ÷ 2314
3 ÷ 2115
1 ÷ 2016 (MSB)

Reading the remainders from bit 6 down to bit 0 gives 12510 = 11111012.

Example: convert 25 to binary

Division by 2QuotientRemainderBit #
25 ÷ 21210 (LSB)
12 ÷ 2601
6 ÷ 2302
3 ÷ 2113
1 ÷ 2014 (MSB)

So 2510 = 110012.

Shortcut: learn the powers of 2 (1, 2, 4, 8, 16, 32, 64, 128). Subtract the largest power that fits, write a 1 for it, and repeat with what is left. Every power you skip gets a 0.

Negative numbers and two's complement

Binary has no minus sign in computer memory. Negative whole numbers are stored in two's complement: write the positive number using a fixed number of bits, flip every bit, then add 1. For -5 in 8 bits, 5 is 00000101, the flipped value is 11111010, and adding 1 gives 11111011. The converter above shows this result automatically, using the smallest width of 8, 16, 32, 64 or more bits that fits the value.

Decimal to binary conversion table

DecimalBinaryHex
000
111
2102
3113
41004
51015
61106
71117
810008
910019
101010A
111011B
121100C
131101D
141110E
151111F
161000010
171000111
181001012
191001113
201010014
211010115
221011016
231011117
241100018
251100119
26110101A
27110111B
28111001C
29111011D
30111101E
31111111F
3210000020
64100000040
1281000000080
256100000000100

FAQs

How do I convert decimal to binary?

Divide by 2 again and again, keep each remainder, and read the remainders from the last to the first. For example, 13 gives 1101.

What is 10 in binary?

10 in decimal is 1010 in binary, because 10 = 8 + 2.

How do I convert a negative number to binary?

Use two's complement. Write the positive value in a fixed number of bits, invert all the bits and add 1. The converter shows the result for you.

What is the largest decimal number in 8 bits?

Unsigned, it is 255 (11111111). Signed, an 8-bit number runs from -128 to 127.

What is the difference between big endian and little endian?

Big endian stores the most significant byte at the lowest address. Little endian stores the least significant byte there instead.

Does the converter work for text?

Yes. Choose Text in the From or To list. Text is converted as UTF-8 bytes, so letters, Hindi characters and emoji all work.

This tool is for general educational use. Everything is calculated in your browser and nothing you type is sent to a server.

Leave a Reply

Your email address will not be published. Required fields are marked *