NHRepon
Home
Services
All ServicesWeb Application DevelopmentMobile Application DevelopmentDigital Marketing and SEO
ProjectsToolsProductsPostsAboutContactLogin
HomeServicesProjectsToolsProductsPostsAboutContact
  • Home
  • Projects
  • Posts
Home/Tools/Calculators/Binary Calculator
All Tools

Binary Calculator

Add, subtract, multiply and divide binary numbers, and apply AND, OR, XOR, NOT and shifts — with every result shown in binary, octal, decimal and hex, plus 8, 16, 32 and 64-bit views.

Operation
Binary
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0001 0001
Hexadecimal
11
Octal
21
Decimal
17
The result read at 8, 16, 32 and 64 bits
WidthUnsignedSigned (two's complement)
8-bit1717
16-bit1717
32-bit1717
64-bit1717

Why the width has to be stated

Binary arithmetic on a computer is modular, and the modulus is the word size. An 8-bit register holding 255 and given one more does not produce 256: it wraps to 0 and sets the carry flag. That is why the same bits mean different numbers depending on how wide the field is, and why the table above shows the result at four widths at once. A value that fits comfortably in 64 bits may be a negative number in 8, and the correct reading depends on what the machine that produced it used.

Signed integers are the reason for two's complement. The leftmost bit of a word is treated as a sign with a weight of minus two to the power of the width minus one, so an 8-bit 1111 1111 is minus one rather than 255. The benefit is that addition does not need to know about signs — the same circuit adds 1 and 1111 1111 to give 0, which is why the representation outcompeted the alternatives. The cost is the asymmetry: the most negative value has no positive counterpart, since the positive version of 1000 0000 is not representable in eight bits.

Bitwise operations are where binary arithmetic stops being a curiosity. AND is used to test and clear bits — a mask of 0000 1111 keeps the low nibble and discards the rest. OR sets them. XOR toggles them, which is why it appears in cheap checksums, in graphics blending and in the classic trick of swapping two values without a temporary. A left shift multiplies by powers of two and a right shift divides, rounding towards negative infinity for signed values and truncating for unsigned ones. All of these are exact and lossless, which is why they are still the fastest way to do certain arithmetic on values that are really bit patterns rather than quantities — flags, colours, IP addresses and network masks.

What does a binary calculator do?

It performs arithmetic and bitwise operations on numbers written in binary, and shows the result in binary, octal, decimal and hexadecimal at the same time. Each operand can be entered in any of those bases, so you can add a hex value to a binary one without converting by hand first.

The arithmetic side covers addition, subtraction, multiplication, division and remainder. The bitwise side covers AND, OR and XOR, which combine two operands bit by bit, along with NOT, which flips every bit, and the left and right shifts. Those operations are not a curiosity: masking, flag sets, colour channels, IP addresses and network prefixes are all bit patterns rather than quantities, and bitwise arithmetic is the natural way to work with them.

Because the machine's word size is what makes binary arithmetic wrap around, the result is also shown at 8, 16, 32 and 64 bits, in both the unsigned and the two's complement reading. A value that looks like a large positive number at 64 bits can be a small negative one at 8, and seeing both readings side by side is usually the quickest way to understand a value that came out of a program.

How to use the binary calculator

  1. Enter the first operand, then choose the base it is written in using the bin, oct, dec and hex buttons beneath the box.
  2. Enter the second operand and its base. It is ignored for NOT, which takes a single value.
  3. Pick an operation from the list: the four arithmetic ones, remainder, AND, OR, XOR, the two shifts, or NOT.
  4. Read the result in binary, hexadecimal, octal and decimal, each grouped for legibility.
  5. Look at the width table below. It gives the unsigned and the signed reading of the result at 8, 16, 32 and 64 bits.
  6. Note the reminder under the result when you divide or use NOT: division reports the remainder, and NOT is shown as 64-bit two's complement, since inverting an arbitrary-precision integer is negative by definition.

Binary Calculator limits and rules

Limits, caps and standards referenced by this tool
ItemLimit
Input basesBinary, octal, decimal and hexadecimal, chosen per operand
PrefixesA leading 0b, 0o or 0x is accepted and stripped
ArithmeticAdd, subtract, multiply, divide with remainder, and modulo
BitwiseAND, OR, XOR, NOT, shift left and shift right
PrecisionExact integer arithmetic, with no floating-point rounding
Widths shown8, 16, 32 and 64 bits, unsigned and two's complement signed
DivisionInteger division, with the remainder reported separately
Shift ruleShifts follow JavaScript semantics on the 64-bit value shown

When to use it

  • Adding or subtracting values you have in binary without converting them by hand first.
  • Applying a bit mask to see which flags survive an AND.
  • Working out the two's complement reading of a byte that came out of a program as a large positive number.
  • Converting a hex value to decimal and checking the arithmetic at the same time.
  • Checking what a left or right shift by a given amount does to a value.

Is it private?

Every calculation is done with JavaScript integers in this page. Nothing is sent to a server, stored or logged, and the tool keeps working if the network drops after the page has loaded.

Frequently asked questions

Because binary arithmetic is modular, and the modulus is the width of the field the value lives in. A byte holding 255 and given one more does not produce 256; it wraps to 0 and sets a carry. The same sixteen bits mean 65535 in an unsigned 16-bit field and minus one in a signed one. Since the number alone does not say how wide the field is, the tool shows the reading at each common width, and the one you want is whichever matches the machine that produced the value.

It is the way signed integers are represented: the leftmost bit of a word carries a negative weight, so in eight bits 1111 1111 is minus one rather than 255. The advantage is that addition and subtraction need no special case — the same circuit adds 1 and 1111 1111 and gets 0, exactly as it would for the values 1 and minus 1 — which is why it displaced the older sign-and-magnitude and one's complement schemes. Its one cost is asymmetry: the most negative value in a width has no positive counterpart.

Because NOT inverts every bit of an arbitrary-precision integer, and in two's complement the inverse of a value is its negation minus one. So NOT 0 is minus one and NOT 5 is minus six. On a fixed-width machine the result is the same bits, just read within that width; in 8-bit terms NOT 0000 0101 is 1111 1010, which is 250 unsigned and minus six signed. That is why the width table matters more than usual for this operation, and why the tool notes that it shows the 64-bit reading.

Differently in ways that surprise people. A right shift of a negative value moves the sign bit down, so the value stays negative and moves towards zero — it is an arithmetic shift rather than a logical one, and it rounds down rather than towards zero. A left shift simply multiplies by a power of two and can overflow, which at a fixed width discards the highest bits. When you need to move bits through an unsigned field, mask the value to the width first so the sign bit cannot interfere.

The arithmetic is exact arbitrary-precision integer arithmetic, so addition, multiplication and the bitwise operations are correct far beyond 64 bits. The width table, though, is about how a fixed-width machine would read the value, and 64 bits is the widest common word size, so that is where it stops. Values that exceed 64 bits are still calculated and converted correctly; they simply have no single-machine reading in the table. If you need a wider field, the binary and hex outputs are the exact ones to read.

The base conversion part is, but the bitwise operations and the width table are not usually there. Most calculator applications let you switch display between bases; fewer offer AND, OR, XOR and shifts, and fewer still show you what the result means as a signed value at each common width. Those two things are what this tool is for. For arithmetic on quantities rather than bit patterns, a general calculator is the better choice, since round-off and decimal fractions are outside what integer arithmetic here will do.

Related tools

  • Number Base Converter
  • Text to Binary Converter
  • Decimal to ASCII
  • Color Converter
  • Data Size Converter

Written and maintained by Md. Nur Hossain Repon.

NHRepon


Md. Nur Hossain Repon expert in NextJS, React, React Native and Flutter. He is a full-stack web and mobile application developer with 5+ years of experience and a passion for building innovative and robust application. Also, he has a strong background in developing high-quality web and mobile applications using the latest technologies and frameworks.
Let's build something amazing together 🚀

Quick Links


  • About
  • Projects
  • Services
  • Contact
  • Posts
  • Products
  • Privacy Policy
  • Terms of Service
  • Tools
  • Smart Life Hubs

Newsletter


We respect your privacy. Unsubscribe anytime.

Connect


© 2026 NHRepon. All rights reserved.

Build v1.5.4+56.73c4a90