Binary Calculator

Add, subtract, multiply or divide two binary numbers.

Last updated:

Binary Calculator

Calculate binary arithmetic instantly, or switch to Programmer Mode for bit-level operations.

BIGINT
Number A BINARY · BASE 2
Use 0 and 1. Spaces and a 0b prefix are allowed.
Operation
Number B BINARY · BASE 2
Enter the second binary number.
Binary Result
10111
1010 + 1101
Binary · Base 2
10111
Decimal · Base 10
23
Hexadecimal · Base 16
17
Octal · Base 8
27
Division Result
Quotient —
Remainder —
⚠ Overflow occurred —
Fixed-Width Interpretation —
Show Step-by-Step Solution
Enter two numbers to see the working.

Programmer Options

Control input bases, bit width, signed interpretation, overflow and shift behavior.

ADVANCED
Prefixes such as 0b, 0o and 0x are also recognized.
Mixed-base arithmetic is supported.
Fixed widths enable register-style wrapping and overflow detection.
Signed fixed-width values use two's-complement interpretation.
Group Binary Bits Display long values in groups of four.
Arithmetic shift preserves the sign when Signed mode is active.
Interactive Result Bits
Available for fixed-width results. Tap a bit to toggle it and inspect its value.
Binary —
Decimal —
Hex —
Octal —

Quick Examples

Load a calculation instantly to see how binary operations work.

EXAMPLES

Quick Base Converter

Convert a single integer between binary, decimal, hexadecimal and octal.

CONVERT
Binary · Base 2 11111111
Decimal · Base 10 255
Hexadecimal · Base 16 FF
Octal · Base 8 377

Two's Complement Converter

Invert a fixed-width binary pattern and add one.

SIGNED
Two's Complement 11111011 Signed value: −5

Recent Calculations

Calculations you copy or explicitly calculate can be reused on this browser.

LOCAL

Advertisement

Binary Calculator

Use the binary calculator above to perform calculations with binary numbers made from 0s and 1s.

You can add, subtract, multiply, or divide binary numbers and instantly see the result in:

Binary

Decimal

Hexadecimal

Octal

For more technical work, switch to Programmer Mode to use bitwise operations, fixed bit widths, signed values, two’s complement, shifts, and overflow checking.

How to Use the Binary Calculator

Using the calculator is simple.

Enter your first binary number, choose an operation, and enter the second binary number.

For example:

1010 + 1101

The result is:

10111

The same value is also:

Decimal: 23

Hexadecimal: 17

Octal: 27

The result updates automatically when you change a number or operation.

What Is a Binary Number?

Binary is a number system that uses only:

0 and 1

Computers use binary because digital hardware commonly works with two states, such as:

off / on

or:

0 / 1

Each binary digit is called a bit.

For example:

1010₂ = 10₁₀

The small 2 means the number is written in base 2.

Binary Addition

Binary addition works much like normal decimal addition, but only 0 and 1 are used.

The basic rules are:

0 + 0 = 0

0 + 1 = 1

1 + 0 = 1

1 + 1 = 10

When adding 1 + 1, write 0 and carry 1 to the next column.

Example:

[object HTMLPreElement]

You can use the calculator to perform binary addition automatically.

Binary Subtraction

Binary subtraction also works from right to left.

When the upper bit is smaller than the lower bit, you borrow from the next binary position.

Example:

[object HTMLPreElement]

The calculator handles the borrowing automatically.

It can also show negative results in normal Simple Mode.

Binary Multiplication

Binary multiplication is simpler than decimal multiplication because each digit is either 0 or 1.

The main rules are:

0 × anything = 0

1 × a binary number = the same binary number

Example:

[object HTMLPreElement]

The calculator performs the multiplication using integer arithmetic, so it can also handle long binary values.

Binary Division

Binary division works similarly to long division.

For example:

1011 ÷ 10

gives:

Quotient: 101

Remainder: 1

The calculator shows both the quotient and remainder when division is selected.

Binary to Decimal Conversion

Binary can be converted to decimal by adding the powers of two represented by each 1 bit.

For example:

1010

means:

8 + 0 + 2 + 0 = 10

So:

1010₂ = 10₁₀

The calculator automatically shows the decimal value for every result.

Binary to Hexadecimal Conversion

Binary maps neatly to hexadecimal because one hexadecimal digit represents four binary bits.

For example:

1111₂ = F₁₆

and:

11111111₂ = FF₁₆

The calculator shows the hexadecimal result automatically.

Binary to Octal Conversion

Octal uses base 8 and can be converted from binary by grouping bits in sets of three.

For example:

111111₂ = 77₈

You do not need to group the bits manually because the calculator displays the octal value instantly.

Quick Base Converter

The built-in base converter lets you enter one value and convert it between:

Binary — base 2

Octal — base 8

Decimal — base 10

Hexadecimal — base 16

For example:

255 decimal

becomes:

Binary: 11111111

Hexadecimal: FF

Octal: 377

This is useful when you only need conversion and do not need to perform an arithmetic operation.

Bitwise AND

The AND operation compares corresponding bits.

The result is 1 only when both bits are 1.

Example:

[object HTMLPreElement]

So:

1100 AND 1010 = 1000

Bitwise OR

The OR operation returns 1 when either bit is 1.

Example:

[object HTMLPreElement]

So:

1100 OR 1010 = 1110

Bitwise XOR

The XOR operation returns 1 when the two bits are different.

Example:

[object HTMLPreElement]

So:

1100 XOR 1010 = 0110

Bitwise NOT

NOT reverses every bit.

A 0 becomes 1, and a 1 becomes 0.

For example, using 8 bits:

[object HTMLPreElement]

becomes:

[object HTMLPreElement]

NOT requires a fixed bit width because the calculator needs to know how many bits should be inverted.

Left and Right Shift

A left shift moves bits to the left.

Example:

0011 << 2 = 1100

For positive integers, shifting left by one position is similar to multiplying by 2.

A right shift moves bits to the right.

Example:

1100 >> 2 = 0011

Programmer Mode also lets you choose logical or arithmetic right-shift behavior where applicable.

What Is Programmer Mode?

Simple Mode is designed for normal binary arithmetic.

Programmer Mode adds technical controls such as:

AND

OR

XOR

NOT

Left shift

Right shift

8-bit, 16-bit, 32-bit, and 64-bit widths

Signed and unsigned values

Two’s complement

Overflow detection

Mixed-base input

This keeps the basic calculator easy while still giving developers and students more control when needed.

Signed and Unsigned Binary Numbers

A fixed-width binary pattern can represent different values depending on whether it is treated as signed or unsigned.

For example, with 8 bits:

11111111

means:

Unsigned: 255

but in signed two’s-complement form it means:

−1

The calculator can show both interpretations when using a fixed bit width.

What Is Two’s Complement?

Two’s complement is a common way computers represent negative binary integers.

To find the two’s complement of a fixed-width positive binary value:

  1. Invert every bit.
  2. Add 1.

For example:

[object HTMLPreElement]

Invert:

[object HTMLPreElement]

Add 1:

[object HTMLPreElement]

In 8-bit signed form:

11111011 = −5

The built-in two’s-complement converter can perform this automatically.

What Is Binary Overflow?

Overflow happens when a result does not fit inside the selected number of bits.

For example, the largest 8-bit unsigned value is:

11111111 = 255

Adding 1 gives:

[object HTMLPreElement]

The mathematical result is 256, but only eight bits can be stored.

The stored 8-bit pattern becomes:

00000000

The calculator does not hide this. It shows both the mathematical result and the fixed-width stored result and tells you when overflow occurs.

Why Does Bit Width Matter?

Bit width tells the calculator how many bits are available.

Common widths include:

8-bit

16-bit

32-bit

64-bit

If you choose Auto / Unbounded, the calculator uses enough space for the complete mathematical result.

This is useful for normal arithmetic because the answer is not forced into a fixed register size.

Can I Use Very Long Binary Numbers?

Yes.

The calculator uses integer arithmetic based on BigInt for normal calculations, allowing values larger than JavaScript's normal safe integer limit.

This makes the tool more suitable for long binary numbers and programming-related calculations.

Can I Enter Spaces in Binary Numbers?

Yes.

You can enter values such as:

1111 0000 1010

The calculator ignores the spaces while calculating.

This can make long binary values easier to read.

In Programmer Mode, you can also enable grouped binary output.

Can I Enter 0b Before a Binary Number?

Yes.

Both forms are accepted:

101010

and:

0b101010

In Programmer Mode, standard prefixes can also be used for other bases, including:

0xFF for hexadecimal

0o77 for octal

Can I Mix Different Number Bases?

Yes, in Programmer Mode.

For example:

Binary A: 1010

and:

Hex B: F

can be used in the same calculation.

Their decimal values are 10 and 15, so:

1010₂ + F₁₆ = 11001₂

This is useful when working with code, registers, memory addresses, protocols, and hexadecimal documentation.

Why Use a Binary Calculator?

Manual binary calculations become difficult when values get longer or when you need to switch between several number systems.

This calculator can help with:

  • Computer science homework
  • Programming
  • Digital electronics
  • Networking
  • Embedded systems
  • Binary arithmetic practice
  • Bit masks
  • Register values
  • Base conversion
  • Two’s-complement calculations

Everything is calculated directly in your browser.

Frequently Asked Questions

What is a binary calculator?

A binary calculator performs arithmetic and bitwise operations using base-2 numbers made from 0 and 1.

Can this calculator add binary numbers?

Yes. Enter two binary values and choose Add to get the binary result plus decimal, hexadecimal, and octal equivalents.

Can it subtract binary numbers?

Yes. Binary subtraction is supported, including negative results in Simple Mode.

Can it multiply binary numbers?

Yes. The tool performs binary multiplication using integer arithmetic.

Does binary division show the remainder?

Yes. Division displays both the quotient and remainder.

Can I convert binary to decimal?

Yes. The result automatically includes its decimal equivalent, and the Quick Base Converter can convert a standalone binary number.

Can I convert decimal to binary?

Yes. Enter a decimal number in the Quick Base Converter and select Decimal as the input base.

Does the calculator support AND, OR and XOR?

Yes. These operations are available in Programmer Mode.

Does it support NOT?

Yes. Select a fixed 8, 16, 32, or 64-bit width before using NOT.

What does signed mode mean?

Signed mode treats fixed-width bit patterns using two’s-complement representation, allowing negative values.

What is an 8-bit binary number?

An 8-bit binary number contains eight bits. Unsigned values can range from 0 to 255, while signed two’s-complement values range from −128 to 127.

Does the calculator detect overflow?

Yes. With a fixed bit width, the calculator can show when a mathematical result falls outside the selected signed or unsigned range.

Can I calculate with large binary numbers?

Yes. Unbounded arithmetic uses BigInt instead of ordinary floating-point numbers.

Are calculations sent to a server?

No. The calculator logic runs locally in the browser.

Can I see how the binary calculation works?

Yes. Open Show Step-by-Step Solution to view a simpler explanation of the selected operation.