Skip to content

Developer / IT · Number Systems

Binary & Hex Calculator — Arithmetic, Bitwise AND/OR/XOR & Shifts

Do arithmetic and bitwise operations directly in binary, octal, decimal or hexadecimal: +, −, ×, integer ÷ with remainder, AND, OR, XOR, NOT and left/right shifts. See the answer in all four bases, grouped for reading, and pick an 8-, 16-, 32- or 64-bit width to see two's complement and overflow.

Also listed inMathematics

Your inputs

Quick start — try a typical case

With a width, negative results are shown in two's complement and overflow is flagged.

Your result Live

Result (binary)

1 0010 0011

291 in decimal

Binary
1 0010 0011
Octal
443
Decimal
291
Hexadecimal
123

How this is calculated

Arithmetic as in decimal, carrying in the chosen base · AND/OR/XOR bit by bit · A << n = A × 2ⁿ · A >> n = ⌊A ÷ 2ⁿ⌋ · two's complement: −x = 2ʷ − x

w
Bit width

Binary arithmetic works like decimal, but you carry at 2 instead of 10: 1 + 1 = 10. Bitwise operations compare the numbers bit by bit — AND keeps bits set in both, OR in either, XOR in exactly one. Shifting left by n multiplies by 2ⁿ. Computers store negative numbers in two's complement: in 8 bits, −1 is 1111 1111.

Assumptions & sources

  • Integers only. Division truncates toward zero; the remainder has the sign of A.
  • Right shifts of negative numbers are arithmetic (the sign is kept).
  1. 1Number systems and binary arithmetic — NCERT Computer Science, Class 11 — Encoding Schemes and Number System

Calculator ID DEV-BINARY-001 · version 1.0.0

Common questions

What is 1011 + 0110 in binary?

10001 (11 + 6 = 17).

What does XOR do?

Each result bit is 1 when exactly one of the two input bits is 1: 1100 XOR 1010 = 0110.

How is −5 stored in 8 bits?

As 1111 1011 in two's complement: 256 − 5 = 251.