Binary Number Calculator

Enter the operation and the binary numbers you want to calculate. The entered values should be positive integers. Decimal results are displayed truncated to the unit.

Invalid binary number 1
Invalid binary number 2

In binary:

=

In decimal:

=

Share this calculator

What is a binary number?

A binary number is a numeral system that uses only two digits: 0 and 1. It is mainly used in computer science and electronics to represent information in the two-state electrical system, on or off (1 or 0). The binary system is the basic system used by computers and electronic devices to process and store information as it is easy to implement electronically and easy for electronic circuits to process and store.

Binary numbers are used in a wide range of applications, such as encoding images and audio in digital format, transmitting information on computer networks, programming microprocessors, and representing numbers in machine language.

An example of a binary number is the number 1001, which in decimal is equal to 9.

How to add binary numbers

To add two binary numbers, the same procedure used to add two decimal numbers is used, with the difference that only two digits are used in the binary system: 0 and 1.

The steps to add two binary numbers are as follows:

  1. Align the binary numbers so that the least significant digits are in the same column.
  2. Add the corresponding digits of each column. If the sum is equal to 2 or greater, carry over 1 to the next digit to the left.
  3. Repeat step 2 for each column until you reach the leftmost digit.
  4. The final result is the obtained binary number.

How to Subtract Binary Numbers

To subtract two binary numbers, a method similar to adding binary numbers is used, with the difference being that attention must be paid to cases where the right column number is less than the left column number.

The steps to subtract two binary numbers are as follows:

  1. Align the binary numbers so that the least significant digits are in the same column.
  2. Subtract the corresponding digits of each column. If the digit to be subtracted is smaller than the digit it will subtract from, borrow 1 unit from the digit in the next column, just as in the decimal system.
  3. Repeat step 2 for each column until you reach the leftmost digit.
  4. The final result is the obtained binary number.

How to Convert a Binary Number to Decimal

To convert a binary number to decimal, the following formula is used:

(digit_1 · 2^(n-1)) + (digit_2 · 2^(n-2)) + ... + (digit_n · 2^0)

Where digit_1 is the leftmost digit of the binary number, digit_2 is the next, and so on, and n is the total number of digits in the binary number to be converted.

Example: Convert the binary number 1101 to decimal.

  1. Determine the value of n. In this case, n = 4
  2. Replace the digits in the formula. This way, we have:
(1 · 2^3) + (1 · 2^2) + (0 · 2^1) + (1 · 2^0)
= 8 + 4 + 0 + 2
= 13

Differences Between Decimal and Binary Systems

Decimal System

It is a base-10 numbering system and is the worldwide standard. Each digit that makes up a decimal number must take values between 0 and 9. If the digit value exceeds 9, a new digit must be added for its correct representation.

Binary System

It is a base-2 numbering system and is very popular in the world of computing. Numbers in this binary system are composed of digits that can take values between 0 and 1. Because its digits have fewer possible values, the representation chain of a number in binary is longer than one represented in decimal.

Table of Equivalences Between Decimal and Binary Numbers

Representation of numbers in each of the numbering systems.

Decimal System
Binary System
0
0
1
1
2
10
3
11
4
100
5
101
6
110
7
111
8
1000
9
1001
10
1010
11
1011
12
1100
13
1101
14
1110
15
1111