Binary Converter

Math

Choose binary to decimal or decimal to binary and enter a whole number. For binary, type only the digits 0 and 1. You get the result and the same number in groups of 4 bits, hexadecimal and octal.

Convert

A whole number from 0 to 9,007,199,254,740,991, for example 100 or 255.

Your entries stay on your device. The math runs right in your browser.

Result: Binary number

1100100

The decimal number 100 equals 1100100 in binary, 64 in hexadecimal and 144 in octal.

  • Binary in groups of 4 bits: 0110 0100
  • Hexadecimal: 64
  • Octal: 144
  • Binary digits (bits): 7

Decimal to binary chart (0 to 1,024)

Common decimal numbers in binary and hexadecimal
DecimalBinary (groups of 4 bits)Hexadecimal
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
101010A
111011B
121100C
131101D
141110E
151111F
160001 000010
200001 010014
320010 000020
500011 001032
640100 000040
1000110 010064
1281000 000080
2551111 1111FF
2560001 0000 0000100
1,0000011 1110 10003E8
1,0240100 0000 0000400

Powers of 2 chart (2⁰ to 2¹⁶)

Powers of 2: the value of each binary digit
Position n (from the right)Value 2ⁿ
01
12
24
38
416
532
664
7128
8256
9512
101,024
112,048
124,096
138,192
1416,384
1532,768
1665,536

Step by step

100 in base 10 = 1100100 in base 2

  1. Divide 100 by 2 again and again, noting the remainder (0 or 1) each time, until the quotient is 0.
  2. The remainders, read from the last to the first, are the binary digits: 1100100.
  3. The same number in groups of 4 bits is 0110 0100, in hexadecimal 64 and in octal 144.

Formula

N = 2 · q + r, with r = 0 or 1
N
the number in base 10
q, r
the quotient and the remainder when N is divided by 2; repeat on the quotient until it reaches 0

How it works

The decimal system is base 10: it uses ten digits, 0 to 9, and each place is worth a power of 10, which is 1, 10, 100 and so on. The binary system is base 2. It uses only 0 and 1, and each place, counting from the right, is worth a power of 2: 1, 2, 4, 8, 16, 32, 64 and so on. To change binary to decimal, add up the powers of 2 in the places that hold a 1. For 1100100 that is 64 + 32 + 4 = 100.

To change decimal to binary, divide the number by 2 and write down the remainder, which is 0 or 1. Then divide the quotient by 2 and repeat until you reach 0. The remainders, read from the last to the first, are the binary digits, so 100 becomes 1100100. The converter does the same and also shows the number in hexadecimal (base 16, where one digit stands for 4 bits) and octal (base 8, where one digit stands for 3 bits). Eight bits make a byte, which can hold 256 values, from 0 to 255.

This converter works with whole numbers, not with text. A binary number goes into a number field, and its digits 0 and 1 are read as binary digits, which allows up to 16 of them, or 65,535 in decimal. The decimal field takes any whole number up to 9,007,199,254,740,991, which is 53 bits. Fractions and negative numbers are not included; the FAQ shows how they are written. To see the binary code of a letter, look up its ASCII code and enter that number. Other number systems are covered by the roman numeral converter and the decimal to fraction converter.

The formula

Position works the same way as in decimal. In 1100100, the leftmost digit is worth 2⁶ = 64, the next 2⁵ = 32, the fifth 2² = 4, and the other digits are zeros. Each binary digit is a bit. With n bits you can write the numbers from 0 to 2ⁿ − 1, so 8 bits cover 0 to 255 and 16 bits cover 0 to 65,535.

Computers use binary because digital circuits handle two voltage levels easily, and those are read as 0 and 1. Hexadecimal is a handy shorthand, since one digit matches exactly 4 bits: 143 is 1000 1111 in binary and 8F in hexadecimal.

Example

How do you write 100 in binary?

  1. Divide by 2: 100 / 2 = 50 r 0, 50 / 2 = 25 r 0, 25 / 2 = 12 r 1, 12 / 2 = 6 r 0, 6 / 2 = 3 r 0, 3 / 2 = 1 r 1, 1 / 2 = 0 r 1.
  2. Read the remainders from the last to the first: 1100100, which is 0110 0100 in groups of 4 bits.
  3. Check: 64 + 32 + 4 = 100. In hexadecimal the number is 64, and in octal it is 144.

The decimal number 100 equals 1100100 in binary, 64 in hexadecimal and 144 in octal.

Load this example into the calculator

Frequently asked questions

How do I convert binary to decimal?

Multiply each digit by the power of 2 for its place, counting from the right and starting at 2⁰, then add the results. For 1001 that is 1 · 8 + 0 · 4 + 0 · 2 + 1 · 1 = 9. Quicker: add the powers of 2 of the places that hold a 1.

How do I convert decimal to binary?

Divide the number by 2, write the remainder, divide the quotient by 2 again, and repeat until the quotient is 0. Read the remainders from the last to the first. For 13: 13 / 2 = 6 r 1, 6 / 2 = 3 r 0, 3 / 2 = 1 r 1, 1 / 2 = 0 r 1, so 13 is 1101.

What is 1010 in decimal?

The binary number 1010 is 10 in decimal: 1 · 8 + 0 · 4 + 1 · 2 + 0 · 1 = 8 + 2 = 10. Going the other way, 10 in decimal is written 1010 in binary.

What is 11111111 in decimal?

It is 255. Eight ones in a row are worth 2⁸ − 1 = 255, the largest number that fits in 8 bits, which is one byte. Adding one more makes 256, or 100000000 in binary.

How do you write 100 in binary?

100 is 1100100 in binary, because 64 + 32 + 4 = 100. In groups of four bits it reads 0110 0100, and in hexadecimal it is 64. Choose "decimal → binary" above, type 100 and the converter shows all three.

What is the binary number system?

It is a positional number system in base 2. It uses only the digits 0 and 1, and each place is worth a power of 2. Computers store everything as binary, because circuits handle two states, on and off, much more reliably than ten.

How many numbers can you write with 8 bits?

256, from 0 (00000000) to 255 (11111111). In general, n bits give 2ⁿ numbers, from 0 to 2ⁿ − 1: 4 bits give 16 numbers and 16 bits give 65,536.

Can this converter change text into binary?

No, it converts numbers. To get the binary code of a letter, look up its ASCII code and enter that number with "decimal → binary". A is 65, which is 1000001, or 01000001 as a full byte. H is 72 (01001000) and i is 105 (01101001), so "Hi" is 01001000 01101001.

How do I convert binary to hex?

Split the bits into groups of four, starting from the right, and write one hexadecimal digit for each group: 0 to 9, then A to F for 10 to 15. For 1000 1111, that gives 8F, which is 143 in decimal. This converter shows the hexadecimal value under every result.

How do I convert hex to binary?

Replace each hexadecimal digit with its 4-bit group: A3 becomes 1010 0011 and 7F becomes 0111 1111. This converter does not take hexadecimal input, so work it out by hand or turn the hex value into decimal first and enter that.

How do you add binary numbers?

Add them like decimal numbers, carrying when a column reaches 2: 1 + 1 = 10, which is a 0 with a carry of 1. Or convert both numbers to decimal, add, and convert the sum back: 101 + 11 is 5 + 3 = 8, which is 1000. Use this converter for the conversions.

How are fractions and negative numbers written in binary?

For a fraction, multiply the fractional part by 2 repeatedly and note each whole digit: 0.625 gives 101, so 10.625 is 1010.101. A negative number is usually stored in two's complement: invert the bits of the positive number and add 1, so 5 is 00000101 and -5 is 11111011 in 8 bits. This converter handles whole numbers from 0 up.

What is the largest binary number I can enter?

The binary field takes up to 16 digits, 1111111111111111, which is 65,535 in decimal. Longer binary numbers lose accuracy when they are read as ordinary numbers. The decimal field goes up to 9,007,199,254,740,991, which is 53 ones in binary.

Why do commas appear in the binary field?

The field treats the digits as an ordinary number, and when you leave it, it adds thousands separators: 1100100 becomes 1,100,100. This is only how the number is displayed, and the binary number is still 1100100. You can also type groups with a space, like 0110 0100.

Last updated: Responsible editor: Jared Alan
Checked against 26 test cases · How we test