156₁₀ → binary — number base conversion

introrepeated division by 2

Answer

10011100

Why this example is worth doing

The standard decimal-to-binary conversion, done by repeated division: divide by two, record the remainder, repeat, then read the remainders bottom to top. That last instruction is where most errors happen, and the tool prints the division column with an explicit arrow rather than leaving the order implicit. The page also shows the subtract-powers-of-two method beside it, since some courses teach only that one and a student needs to recognise their own method in the working.

Try your own input in the Binary ⇄ decimal ⇄ hex ⇄ octal. Convert between any two bases, integers and fractions, with the positional working.

How the answer is reached

Base 10 to base 2

Convert 156 from base 10 to base 2. The sign is carried across unchanged; only the magnitude is converted.

Positional expansion of the input — Base 10 to base 2
digitvalueweightweight (base 10)digit x weight
1110^2100100
5510^11050
6610^016
total156

Integer part: divide by 2 and read the remainders bottom to top.

Read the last column bottom to top. ↑ — Base 10 to base 2
ndivide byquotientremainder
156156 ÷ 2780
7878 ÷ 2390
3939 ÷ 2191
1919 ÷ 291
99 ÷ 241
44 ÷ 220
22 ÷ 210
11 ÷ 201

156 (base 10)10011100 (base 2)

Compare with

Open this example in the Binary ⇄ decimal ⇄ hex ⇄ octal

The field arrives filled in with this example’s input.

Note:

Notation this page assumes

  • Bit strings are written most significant bit first, and bit 0 is the least significant bit.
  • A width is stated explicitly wherever it changes the answer; nothing is silently sign-extended or truncated.
  • Fractions are converted digit by digit and shown to a stated number of places rather than rounded silently.

Sources

  • Knuth, The Art of Computer Programming, Vol. 2, §4.1 “Positional Number Systems” (1997)
  • IEEE 754-2019, Standard for Floating-Point Arithmetic