Skip to main content
Binary calculator

Add, mask and convert binary in one place.

Enter two binary numbers, pick an operation, and see the result in binary, decimal, hexadecimal and octal, with a full conversion table for every value.

Your numbers

Result in binary
0
binary result

What this means

    Conversion table

    ValueBinaryDecimalHexOctal

    How binary math works

    How Binary Arithmetic Works

    Binary (base-2) arithmetic follows the same rules as decimal arithmetic but uses only two digits: 0 and 1. Binary addition carries over when the sum exceeds 1 (1+1=10 in binary). Subtraction, multiplication, and division work similarly. Computers perform all calculations in binary, making it fundamental to digital systems.

    Number Base Conversions

    This calculator converts results between four number systems: binary (base-2), decimal (base-10), hexadecimal (base-16), and octal (base-8). Hexadecimal is widely used in programming and color codes. Octal was historically important in computing. Understanding conversions between these bases is essential for programmers and engineers.

    Common questions

    How do I convert binary to decimal?

    Each binary digit represents a power of 2, starting from the right. For example, 1010 in binary = 1×8 + 0×4 + 1×2 + 0×1 = 10 in decimal. This calculator performs the conversion automatically and shows the result in decimal, hexadecimal, and octal.

    What if I enter non-binary digits?

    Binary numbers should contain only 0s and 1s. If you enter digits other than 0 and 1, the calculator will attempt to parse the input as a binary string. Digits like 2-9 are not valid in binary and may produce unexpected results.

    What is the largest binary number I can calculate?

    JavaScript handles integers up to 2^53 - 1 (about 9 quadrillion). This means binary numbers up to 53 digits long can be calculated accurately. For most practical purposes, this is more than sufficient.

    Bitwise operations (AND, OR, XOR) use 32-bit unsigned integers. Arithmetic is accurate for integers up to 2^53 - 1.