Binary Division: A Simple Guide

Divide binary numbers with long division: compare, subtract, bring down. Worked examples with remainders, and why dividing by 2 is a right shift.

Binary Division: Long Division Step by Step

Binary division finds how many times one binary number, the divisor, fits into another, the dividend, producing a quotient and sometimes a remainder. Unlike decimal division, it is almost trivial once you internalize the binary long division procedure, because the only quotient digit you ever write is 0 or 1. Every step reduces to a comparison: does the divisor fit into the current partial remainder, yes or no. You can execute that process by hand, with a worked example, a remainder case, and the shortcut for dividing by powers of two using right shifts. You will also get practice problems with decimal verification, so you can check each answer without a calculator.

How Binary Long Division Works

Binary long division is the base-2 version of the decimal long division you learned in school, but with a simplification that removes all guesswork. In decimal, the quotient digit at each step can be any digit from 0 to 9, and you estimate. In binary, the quotient digit is always 1 if the divisor is less than or equal to the current partial dividend, and 0 otherwise. That is the entire rule. The procedure is: bring down one bit at a time, compare the divisor to the current partial value, write a 1 in the quotient and subtract if it fits, or write a 0 and skip the subtraction, then bring down the next bit and repeat until you have used every bit of the dividend.

The layout mirrors decimal long division. The dividend goes under the division bracket, the divisor sits outside on the left, and the quotient is built bit by bit above the bracket, aligned so that each quotient bit sits over the dividend bit that produced it. The subtraction at each step is binary subtraction, which borrows in the same way decimal subtraction does, except that borrowing takes 2 from the next higher bit because the base is 2. If you are comfortable with binary subtraction, the division is just repeated application of that operation. If you are not, the worked example below will make it concrete.

One distinction matters before you start: division with a remainder is normal, and the remainder is always smaller than the divisor. For unsigned binary numbers, the remainder is a non-negative integer, and the quotient times the divisor plus the remainder must equal the original dividend. That check is your best tool for catching a slip. A single wrong borrow propagates through every later step, so verifying the final identity, quotient times divisor plus remainder equals dividend, in decimal is not optional, it is the fastest way to confirm you did not misplace a bit.

Step-by-Step Worked Example: 1101 ÷ 0011

Executing the Long Division

Work through 1101₂ (decimal 13) divided by 0011₂ (decimal 3). The divisor is 0011, which has a leading zero, so treat it as 11. Write the dividend 1101 under the bracket and the divisor 11 outside on the left. The quotient will appear above the bracket, one bit at a time, aligned over the current position. Start with the first bit of the dividend, which is 1. Does 11 fit into 1? No, so write a 0 in the quotient above the first bit. Bring down the next bit, giving 11 as the current partial value. Does 11 fit into 11? Yes, exactly once. Write a 1 in the quotient above the second dividend bit, and subtract 11 from 11, which gives 00.

Bring down the next dividend bit, which is 0, giving a partial value of 00. Does 11 fit into 0? No, so write a 0 in the quotient above the third dividend bit, and skip the subtraction. Bring down the final dividend bit, which is 1, giving a partial value of 01. No, so write a 0 in the quotient above the fourth bit. The quotient is now 0100₂, which is decimal 4, and the remainder is 01₂, which is decimal 1. Check: 4 × 3 = 12, plus 1 = 13, which matches the dividend. The layout looks like this:

0100
______
11 | 1101
11
--
00
00
--
01
00
--
1

The quotient 0100 has a leading zero, which you can drop for the answer: 100₂. The remainder 01 is just 1. This example divides exactly in the sense that the remainder is less than the divisor, but it is not zero, so it is a genuine division with a remainder, not a clean split.

Binary Division With Remainder: 1010 ÷ 0011

Working Through a Non-Even Division

Now try 1010₂ (decimal 10) divided by 0011₂ (decimal 3), which does not divide evenly. The divisor is 11. Write the dividend 1010 under the bracket. Start with the first bit, 1. No, quotient bit 0. Bring down the second bit, giving 10. Does 11 fit into 10? Bring down the third bit, giving 101. Does 11 fit into 101? Yes, it fits once, since 11₂ is 3 and 101₂ is 5. Write a 1 in the quotient above the third bit, and subtract 11 from 101. In binary, 101 minus 11 is 10, because 5 minus 3 is 2. Write 10 below, and bring down the fourth and final bit, which is 0, giving 100.

Now divide 100 by 11. Does 11 fit into 100? Yes, since 100₂ is 4 and 11₂ is 3. Write a 1 in the quotient above the fourth bit, and subtract 11 from 100. In binary, 100 minus 11 is 1, because 4 minus 3 is 1. Check: 3 × 3 = 9, plus 1 = 10, the original dividend.

Notice the borrow in the subtraction step. If you get the subtraction wrong, the quotient bits after that point are all wrong too, which is why the decimal cross-check at the end is non-negotiable.

Dividing by Powers of Two With Right Shifts

Using Right Shifts for Powers of Two

When the divisor is a power of two, which means 2, 4, 8, 16, and so on, binary division collapses into a single operation: a right shift. For example, 1101₂ (13) shifted right by one bit becomes 110₂ (6), because 13 divided by 2 is 6 with a remainder of 1. The bits shifted out are the remainder.

The kind of right shift you use depends on whether the number is signed or unsigned. For unsigned binary numbers, a logical shift right fills the vacated high bits with zeros, and it is exactly equivalent to division by two, truncating toward zero. For signed numbers in two's complement, an arithmetic shift right preserves the sign bit, so a negative number stays negative. For example, in 8-bit two's complement, 11111100₂ (which is -4) shifted right by one bit with an arithmetic shift gives 11111110₂ (which is -2), correctly doubling the value toward zero. A logical shift on the same bits would give 01111110₂ (which is not -2 at all).

In practice, C's behavior on right shift of a negative value is implementation-defined, as the C17 standard states in section 6.5.7 paragraph 5. On GCC and Clang, the arithmetic shift is used for signed types, so -4 >> 1 is -2, but the standard does not require this, and a different compiler could legally produce a logical shift. Python, by contrast, always emulates an arithmetic shift for negative integers, so -4 >> 1 is -2, and since Python integers are unbounded, the sign bit extends infinitely.

Right Shift Types Across Languages
LanguageOperatorSigned Negative Shift ResultFills High Bits With
C (signed int)>>Implementation-defined; arithmetic on GCC/ClangSign bit (on GCC/Clang)
C (unsigned int)>>Not applicable, always logical0
Python>>Arithmetic, floor division by 2**nSign bit (infinite extension)
JavaScript>>Arithmetic, sign-preservingSign bit
JavaScript>>>Logical, turns negative into large positive0

Practice Problems for Binary Division

Working Through Practice Problems

Work these by hand, then verify each in decimal. The quotient is 0101₂ (5) with a remainder of 1₂ (1), since 5 times 2 is 10, plus 1 is 11. The quotient is 1000₂ (8) with a remainder of 10₂ (2), because 8 times 3 is 24, plus 2 is 26.

For each problem, set up the long-division layout, bring down one bit at a time, and write a 1 in the quotient whenever the divisor fits. Another failure is subtracting incorrectly, especially when a borrow propagates across multiple bits. If you get a remainder that is greater than or equal to the divisor, you made an error, because the remainder must always be strictly less than the divisor in unsigned division. The decimal check, quotient times divisor plus remainder equals dividend, will catch every mistake you can make, so do not skip it.

Common Questions

How do I verify my binary division answer without a calculator?

Multiply the quotient by the divisor, add the remainder, and confirm it equals the decimal value of the original dividend. This identity catches any borrow or alignment error.

What happens if the remainder is larger than the divisor?

That signals an error. In unsigned binary division, the remainder must be strictly smaller than the divisor. If it is not, you missed a quotient bit of 1, so go back and re-check the last subtraction step.

Why does binary division only ever produce quotient bits of 0 or 1?

Because the divisor either fits into the current partial value exactly once or not at all. There is no digit 2 in binary, so the quotient bit at each step is simply 1 if the divisor is less than or equal to the partial value, and 0 otherwise.

Can I use a right shift to divide any binary number, not just powers of two?

No. A right shift only divides exactly by powers of two. For other divisors, you must use the full long division procedure. Shifting by n bits discards the remainder as the low bits, which only matches division by 2^n.