U

Binary Calculator

Add, subtract and multiply binary numbers and convert between binary and decimal, with full 8-bit bit-pattern breakdowns of every result.
Input values
170
0255
85
0255

Binary arithmetic result

Breakdown

Bit 7 (128s place)
0
Bit 6 (64s place)
0
Bit 5 (32s place)
0
Bit 4 (16s place)
0
Bit 3 (8s place)
0
Bit 2 (4s place)
0
Bit 1 (2s place)
0
Bit 0 (1s place)
0

Key Assumptions

  • All inputs and outputs are decimal integers between 0 and 255 (8-bit range).
  • Subtraction results below zero are clamped to zero for binary representation.
  • The bit outputs represent the binary digits of the decimal result in big-endian order.
  • Division is not included because it produces fractional results incompatible with integer bit extraction.

Formula Used

Bit n = floor(result / 2^n) mod 2 for n = 0 through 7 Binary value = (bit7 × 128) + (bit6 × 64) + … + (bit0 × 1)
Embed this calculator on your website

Add this embed page to your site — visitors use the calculator right from your page.

Computers, smartphones, networking gear and most digital electronics all speak a single language: binary, the base-2 number system made of nothing but ones and zeroes. The Binary Calculator lets you add, subtract and multiply binary numbers and convert freely between binary and decimal, so you can check homework, debug an algorithm or simply understand how the machine you are reading this on does arithmetic. Because every calculator on this page works in 8-bit binary, you also see the exact bit pattern of each result, which is the closest thing to looking at what a processor actually computes.

What Is a Binary Number System?

Every number system uses a base, which is the number of distinct digits it can write. The decimal system we grew up with is base-10: it has ten digits, 0 through 9, and moving one place to the left multiplies a digit's contribution by 10. Binary is base-2, so it has only two digits, 0 and 1, and moving one place to the left doubles the value of a digit rather than multiplying it by ten. That single difference is why the same quantity looks completely different in the two systems: the decimal number 3 is written as 11 in binary, and the decimal 5 becomes 101.

A binary digit is called a bit, a contraction of "binary digit". Eight bits are grouped into a byte, which is the natural unit of memory in most computers and the size used by this calculator. Understanding binary is fundamental because digital hardware stores every number — and, indirectly, every letter, colour and sound — as patterns of bits. When you see a memory size, a file size or an IP address, you are ultimately looking at binary numbers that have been organised for human eyes.

How Place Values Work in Base-2

In decimal, the value of the number 345 means 3 hundreds, 4 tens and 5 ones. The place values are powers of 10: 10², 10¹ and 10⁰. Binary works exactly the same way, only with powers of 2. An 8-bit number therefore uses these place values, read from the left:

Bit position76543210
Place value1286432168421
Binary 0000101100001011

The rightmost bit is position 0 and contributes 1, the next contributes 2, then 4, 8, 16, 32, 64 and 128. Reading 00001011 from left to right: 8 plus 2 plus 1 equals 11, so the binary pattern 00001011 is simply the decimal number 11. This calculator displays exactly that breakdown — the bit7-through-bit0 outputs show you the individual 0 or 1 at each place. With eight bits, the smallest representable value is 0 (all zeroes) and the largest is 255 (all ones), which is why the input sliders are capped at 255.

Adding Binary Numbers

Binary addition follows the same columns-and-carry method you already know from decimal, but with a much smaller addition table. In decimal, 9 + 1 rolls over to 10. In binary, 1 + 1 rolls over to 10 (which is decimal 2), and 1 + 1 + 1 makes 11 (which is decimal 3). So each column sums pairs of bits that are 0 or 1, and whenever a column reaches 2 or more, you carry a one into the next column to the left.

Consider adding 5 (0101) and 3 (0011). Align the bits on the right and add column by column. The ones column holds 1 + 1 = 2, so you write 0 and carry 1. The twos column then holds 0 + 1 plus the carried 1 = 2, so you write 0 and carry 1 again. The fours column now holds 1 + 0 plus the carried 1 = 2, write 0 and carry 1. Finally the eights column holds the carried 1, giving 1000. In decimal that is 0+0+0+8, or 8, which matches 5 + 3 = 8. The carry is the only tricky part, and this calculator does all of it automatically while also showing the resulting bit pattern.

Subtracting Binary Numbers

Binary subtraction borrows the same way decimal subtraction does, except a borrow brings in a two rather than a ten, because that is the value of the column to the left. If the bit on top is smaller than the bit below it, you borrow from the next column to the left. Each borrow converts the current column's top bit into 10₂, which is decimal 2, and reduces the borrowed-from column by one.

For example, subtract 3 (0011) from 5 (0101). Align the numbers: the ones column is 1 minus 1, which gives 0. The twos column is 0 minus 1, so you borrow one from the fours column. The borrowed value of two makes the twos column 2 minus 1 equals 1. The fours column, which was a 1 before the borrow, becomes 0, and the eights column stays 0. Reading the answer 0010 gives decimal 2, which matches 5 − 3 = 2. When the result would be negative, this calculator clamps the binary display to zero so the bit outputs stay valid 8-bit patterns.

Multiplying Binary Numbers

Binary multiplication is the easiest of the three operations because the only products are 0 × 0 = 0, 1 × 0 = 0 and 1 × 1 = 1. You multiply the same way as decimal long multiplication: for each bit of the second number, write down the first number shifted one place to the left, then add up all the shifted rows. Since a bit is either 0 or 1, each row is either a copy of the first number or all zeroes.

Take 5 (0101) times 3 (0011). The ones bit of 3 is 1, so the first row is 0101. The twos bit of 3 is 1, so the second row is 01010, the first number shifted left one place. The fours bit of 3 is 0, giving a row of zeroes, and so is the eights bit. Adding 0101 and 01010 gives 01111, which weighs 8 + 4 + 2 + 1 = 15, exactly 5 × 3. Multiplication can grow past 8 bits quickly, and the decimal result shown by this calculator is not capped; only the bits above the 8-bit boundary are not displayed.

Converting Decimal to Binary

The classic method for converting a decimal number to binary is repeated division by 2. Divide the number by 2, write down the remainder (always 0 or 1), and continue dividing the quotient until it reaches 0. The remainders, read bottom to top, form the binary number.

  1. Take 13. 13 ÷ 2 = 6 with remainder 1.
  2. 6 ÷ 2 = 3 with remainder 0.
  3. 3 ÷ 2 = 1 with remainder 1.
  4. 1 ÷ 2 = 0 with remainder 1.

Reading the remainders bottom to top gives 1101. Checking the place values: 8 + 4 + 0 + 1 = 13, correct. This is exactly the algorithm underlying this page's binary display — each bit output is extracted from the result by dividing by the relevant power of two and keeping the remainder, so the 128s, 64s, 32s, 16s, 8s, 4s, 2s and 1s places across the eight outputs reconstruct the full pattern.

Converting Binary to Decimal

The reverse conversion is a matter of addition: write the binary number, label each bit with its place value as a power of two, and add the values wherever a 1 appears. Bits that are 0 contribute nothing.

Convert 101101 to decimal. Reading across the six bits, the 1s sit at the 32s, 8s and 4s places, while the 16s, 2s and 1s places hold zeroes. Adding 32 + 8 + 4 gives 44. Every binary number can be converted this way, and the same logic works in reverse for knobs that need a binary value turned into a decimal one, for example when setting permissions or configuring network equipment.

The 8-Bit Range: Why 0 to 255

Eight bits give exactly 2⁸ = 256 distinct combinations, which encode the whole numbers 0 through 255. That range covers a lot of everyday computing: it is the size of a byte, the range of a classic 8-bit colour channel, and the value space of old 8-bit console games. The largest pattern, 11111111, adds 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255, and 00000000 is just 0. If you counted through all 256 patterns — 0, 1, 10, 11, 100 and so on — you would be counting in exactly the same order a digital counter does.

Reading the Bit Outputs

Below the main result this calculator lists eight outputs labelled bit7 through bit0. Each shows a single digit — 0 or 1 — for one place value, from the 128s place at the top to the 1s place at the bottom. Reading those eight outputs top to bottom gives you the result as an 8-bit binary number. For example, with 170 plus 85 the decimal result is 255 and every bit reads 1, producing 11111111. Seeing the result as both a decimal number and a bit pattern is what bridges "normal" arithmetic and the way machines actually compute. In subtraction mode, a difference that clamps to zero makes every bit read 0, which is the honest bit pattern for a clamped negative result.

Where Binary Numbers Are Used

Binary arithmetic is the foundation of almost every digital system. Processors execute addition, subtraction and multiplication on bits in circuits called adders. IP addresses on the internet are 32-bit binary numbers in disguise, file permissions on Unix-like systems store read, write and execute flags as bit patterns, and digital images record each colour channel as bits. Even a power-of-two memory size (128 MB, 256 MB, 512 MB) only makes sense in binary. Practising with a binary calculator builds the intuition that lets you read these patterns instead of trusting the numbers printed on a screen, and it is routinely used by students, programmers and electronics hobbyists.

How to Use This Calculator

Pick your first number with the slider (or type it into the number box) between 0 and 255, set the second number the same way, and choose the operation: Addition, Subtraction or Multiplication. The two largest inputs appear on the sliders so you can verify the bitesized upper bound. The decimal result is highlighted at the top, and the eight bit outputs underneath show the same result rendered as an 8-bit binary pattern. Switch the operation at any time and every output updates instantly, which makes it easy to compare, say, 170 + 85 against 170 × 85 — one stays comfortably inside the byte while the other pushes far beyond it.

Because the inputs are locked to 8-bit values, every addition and subtraction here produces a coherent 8-bit answer, and multiplications are reported in decimal so you always see the true product. Use the quick-amount buttons (0, 15, 85, 170, 255) to jump straight to the boundary values and inspect the nice bit patterns they produce. If you need radix conversions beyond this tool's scope, the conversion calculator on this site handles many more bases.

Key Assumptions

  • Inputs and outputs are whole numbers within the 8-bit range of 0 to 255.
  • Subtraction results that would be negative are clamped to zero so the binary representation stays valid.
  • Bit outputs are shown in big-endian order, from the 128s place down to the 1s place.
  • Multiplication results may exceed 255; the decimal product is shown in full while only the lowest eight bits would be representable.
  • Division is not included because it produces fractional results that a fixed bit pattern cannot represent.

Disclaimer

Results are provided as estimates for informational purposes only and may be inaccurate. Always verify outcomes with a qualified professional before making financial or personal decisions based on these calculations.

FAQs

Related Calculators