Binary Calculator
Convert a number between binary, decimal, hexadecimal and octal, or perform binary arithmetic and bitwise AND, OR, XOR, NOT and shifts.
This guide is not yet available in your language and is shown in English.
Tool guide
What this tool does
Binary Calculator converts any whole number between binary, decimal, hexadecimal and octal, showing all four bases at once, and separately performs binary arithmetic and bitwise operations: addition, subtraction, AND, OR, XOR, NOT, and left or right shifts, with the result shown in binary, decimal and hex.
Working with binary comes up constantly in programming, computer science courses and digital electronics, whether it is converting a value between bases or working out what a bitwise operation actually does to a pair of binary numbers. Doing either by hand is a useful skill to learn, but error-prone to check without a second source.
This calculator covers two separate jobs: converting any whole number from binary, decimal, hexadecimal or octal into all four bases at once, and performing binary arithmetic and bitwise logic, addition, subtraction, AND, OR, XOR, NOT, and left or right shifts, on a pair of binary inputs. Results from the arithmetic mode are computed on the exact mathematical integer value rather than being forced into a fixed register width like 8 or 32 bits, which keeps the underlying logic visible without hiding it behind a specific hardware convention.
How to use Binary Calculator
- Choose Convert between bases or Binary arithmetic / bitwise.
- For conversion, pick the Input base and type the Value in that base.
- Read the equivalent value in Binary, Decimal, Hexadecimal and Octal.
- For arithmetic, enter A and B as binary digits and choose an Operation.
- Read the result in binary, decimal and hexadecimal.
- Switch operations to compare how AND, OR and XOR each treat the same two binary inputs differently.
Tips for better results
- AND keeps a bit only where both inputs have a 1; OR keeps a bit where either input has a 1; XOR keeps a bit only where the inputs differ, which is why XOR-ing a value with itself always gives zero.
- NOT here is a mathematical complement on the exact integer value, not a fixed 8-bit or 32-bit register complement; real hardware NOT depends on the specific register width in use.
- Left shifting a binary number by one position doubles its decimal value; right shifting halves it (rounding toward negative infinity for this tool’s exact-integer shifts).
- When converting, omit any 0x, 0b or 0o prefix; the Input base selector already tells the tool how to read your digits.
Common use cases
- Converting a value between binary, hex and decimal while learning number systems or debugging low-level code.
- Checking a bitwise AND, OR or XOR operation by hand before trusting it in a program.
- Understanding how binary addition and subtraction work digit by digit.
- Teaching or reviewing how left and right shifts relate to multiplying and dividing by powers of two.
Common mistakes to avoid
- Assuming NOT produces a fixed-width result like it would on an 8-bit or 32-bit register; this calculator’s NOT operates on the unrestricted mathematical integer, so the specific bit pattern will differ from a fixed-width hardware NOT.
- Including a base prefix such as 0x or 0b when typing a value; the input base is already selected separately, so a prefix is unnecessary and may be misread.
- Expecting binary subtraction producing a negative result to show up as an unsigned binary pattern; this tool shows a leading minus sign for negative results rather than a two’s-complement bit pattern.
Frequently asked questions
Does this use a fixed bit width like 8-bit or 32-bit?
No, conversions and arithmetic operate on the exact mathematical integer value with no artificial bit-width limit or overflow, which keeps the underlying logic clear but means results, especially for NOT, will differ from a specific hardware register’s fixed-width behaviour.
How is a negative subtraction result shown?
As a plain negative number with a leading minus sign in binary, decimal and hex, rather than as a two’s-complement bit pattern, which is the convention real hardware typically uses instead.
What is the difference between OR and XOR?
OR gives a 1 wherever at least one of the two bits is 1, including when both are 1; XOR gives a 1 only when the two bits differ, so two 1s or two 0s both produce a 0 under XOR.
Can I convert a hexadecimal value directly?
Yes, select Hexadecimal as the Input base and type the value using digits 0-9 and letters A-F (case-insensitive), without a leading 0x.
Feedback & suggestions
Help us improve Binary Calculator. We read every message.