Binary Calculator

BINARY BITWISE MATHEMATICS
Share:

Add, subtract, multiply, divide and run bitwise AND, OR, XOR, NOT and shifts on binary, octal, decimal or hexadecimal numbers, with the result in every base. Free, runs in your browser.

RT-MAT-026 · Mathematics

Binary Calculator

Advertisement
After tool · AD-W1Responsive · Post-tool

How to Use the Binary Calculator

Enter two numbers

Type operand A and operand B, and set the base of each — binary, octal, decimal or hexadecimal. You can mix bases freely, such as a hex A with a binary B.

Choose an operation

Pick arithmetic (add, subtract, multiply, divide, modulo) or a bitwise operation (AND, OR, XOR, NOT, or a left or right shift).

Read every base

The result appears at once in binary, decimal, hexadecimal and octal, with the binary grouped into nibbles for readability.

Work with any size

The calculator uses arbitrary-precision integers, so even very large numbers stay exact — there is no 32-bit or 64-bit overflow on the arithmetic.

Advertisement
After how-to · AD-W2Responsive

Binary: How Computers Count

Base Two and Its Friends

Everyday numbers are written in base ten — ten digits, 0 through 9, with each place worth ten times the one to its right. Computers use base two, or binary, with just two digits, 0 and 1, because those map perfectly onto the two states of a switch: off and on, low voltage and high. Every number, letter, image and instruction inside a machine is ultimately a pattern of these bits. Binary is verbose for humans, though, so two shorthand bases ride alongside it: octal (base eight) groups bits in threes, and hexadecimal (base sixteen) groups them in fours, which is why a single hex digit captures exactly four bits and a byte is two hex digits. This calculator works in all four bases at once — type a number in any of them and see the result in every base, so you can move between the human-friendly decimal and the machine-friendly binary and hex without converting by hand. It performs ordinary arithmetic and the bitwise operations that are the real native language of a processor.

Bitwise operations act on the individual bits of a number rather than its value as a whole, and they are everywhere in low-level programming. AND keeps only the bits set in both numbers, which is how a program masks out the parts of a value it cares about; OR sets a bit if it is on in either number, used to combine flags; XOR flips bits that differ, the basis of simple encryption, checksums and the trick for swapping two values without a temporary. NOT inverts every bit, and because that depends on how wide the number is, this calculator lets you choose an 8-, 16-, 32- or 64-bit width for it. Shifting moves all the bits left or right, which multiplies or divides by powers of two almost for free — a left shift by one doubles a number, a right shift halves it. These operations are how device drivers talk to hardware, how graphics code packs colours into a single integer, and how cryptography and compression squeeze performance out of every cycle. Everything here is computed with arbitrary-precision integers in your browser, so the numbers stay exact at any size.

"A byte is just eight switches. Binary, octal and hexadecimal are three ways of reading the same row of switches — and bitwise operations are how a processor flips them."

Why Bits Matter Beyond Programming

The reach of binary goes well past writing code. Network engineers read IP addresses and subnet masks in binary to see which addresses belong to a network — a calculation that is literally a bitwise AND. File formats and protocols pack many small fields into a single number using shifts and masks, so understanding bitwise operations is how you decode them. Permissions on a Unix system, the familiar 755 or 644, are octal precisely because each group of three permission bits fits one octal digit. Colours on the web are hexadecimal because each pair of hex digits is one byte of red, green or blue. Even outside computing, base conversion sharpens number sense: seeing that 255 is 11111111 in binary and FF in hex, that powers of two line up with round binary numbers, and that a shift is just a multiplication, builds the intuition behind how digital systems represent the world. Whether you are studying computer science, debugging low-level code, working with networks, or simply curious how machines count, this calculator gives you exact results across all four bases instantly and privately.

10 Facts About Binary & Bits

01

Binary uses only 0 and 1 — matching a switch's off and on.

02

A byte is 8 bits and holds values from 0 to 255.

03

One hex digit equals exactly four binary digits.

04

A left shift by one doubles a number; a right shift halves it.

05

XOR can swap two numbers without a temporary variable.

06

A subnet mask is applied with a bitwise AND.

07

Unix file permissions like 755 are written in octal.

08

Web colours like #FF8800 are three hexadecimal bytes.

09

The decimal 255 is 11111111 in binary and FF in hex.

10

This calculator uses arbitrary precision — no overflow at any size.

Frequently Asked Questions

  • Yes. Each operand has its own base selector, so you can, for example, AND a hexadecimal A with a binary B. The calculator converts both to their true value, applies the operation, and shows the result in binary, decimal, hexadecimal and octal at once.
  • AND compares the two numbers bit by bit and keeps a 1 only where both have a 1. It is used to "mask" a value — to isolate certain bits and zero out the rest — and applying a subnet mask to an IP address is exactly a bitwise AND.
  • NOT flips every bit, but the answer depends on how many bits you are considering — flipping within 8 bits gives a different number than within 32 bits. So when you choose NOT, the calculator asks for a width (8, 16, 32 or 64 bits) and inverts the value within that many bits.
  • They are the same thing in binary. Shifting all the bits left by one position doubles the number, and by n positions multiplies it by 2 to the power n; shifting right divides by powers of two. Processors use shifts because they are far faster than general multiplication.
  • No. The arithmetic uses arbitrary-precision integers, so adding or multiplying very large binary or hexadecimal numbers stays exact with no 32-bit or 64-bit overflow. The optional width applies only to the NOT operation, where it is mathematically required.
  • They are compact stand-ins for binary. Each octal digit represents three bits and each hexadecimal digit represents four, so long binary strings become short and readable. That is why colours are written in hex and Unix permissions in octal.
  • Yes — enter your number as operand A, set its base, and leave the operation on something like "A + B" with B set to 0. The result row then shows your number in all four bases. For dedicated conversion, the Number Base Converter is also available.
  • No. Every calculation runs in your browser using native arbitrary-precision integers — nothing is uploaded to a server or third-party library, and the tool works offline once the page has loaded.
  • Bitwise operations on negative numbers depend on a chosen two's-complement width, which is ambiguous without one. To keep results clear and unambiguous, the calculator asks for non-negative operands on AND, OR, XOR and the shifts; ordinary arithmetic still handles negatives.
  • Completely free, with no account, sign-up, or usage limit. It runs entirely in your browser and collects no data. Use it as much as you like.

Related News

You may be interested in these recent stories from our newsroom.

No related news yet for this tool. Our editorial team publishes new pieces every week.

Browse all news →
Advertisement
Pre-footer · AD-W3 728 × 90

75 more free tools

Calculators, converters, security tools — no signup.