Tool for performing bit-by-bit calculations online: logical operations (AND, OR, XOR, NOT, NAND, NOR, XNOR), shifts, rotations, one's and two's complements, bit counting.
Bitwise Calculator - dCode
Tag(s) : Informatics
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
A bitwise calculator is a tool that performs logical and arithmetic operations directly on the bits of a binary number.
It is used to manipulate values at the lowest level (binary level), which is essential in computer science, digital electronics, and systems programming.
Bitwise operations are fast and efficient because they are executed directly by the processor. They allow for optimized calculations, manipulation of flags or masks, and/or rapid encoding/decoding of data.
Basic binary logical operations include:
— AND (&): Each bit of the result is 1 if both corresponding bits of the operands are 1.
— OR (|): Each bit of the result is 1 if at least one of the corresponding bits of the operands is 1.
— XOR (^): Each bit of the result is 1 if the corresponding bits of the operands are different.
— NOT (~): Inverts each bit of the operand (one's complement).
Example: A = 0b1010 and B = 0b1100
A & B = 1000
A | B = 1110
A ^ B = 0110
~A = 0101 and ~B = 0011
There are also operations derived from the basic operations:
— NAND: Result of NOT (A AND B).
— NOR: Result of NOT (A OR B).
— XNOR: Result of NOT (A XOR B), also called logical equivalence
Shifts move the bits of a binary number left or right. A distinction must be made between the logical left shift, denoted <<, and the logical right shift, denoted >>, which adds zeros to the left and right respectively, and the arithmetic shift, which preserves the sign bit (for signed numbers in the case of a right shift).
Example: A << 1 = 0100 (left shift)
A >> 1 = 0101 (logical right shift)
A >>> 1 = 1101 (arithmetic right shift, if A is signed and negative)
Rotations move bits without loss:
rot>: The rightmost bit is moved to the left
rot<: The leftmost bit is moved to the right
— One's complement: Inverts all bits.
— Two's complement: Obtained by adding 1 to the one's complement (used to represent negative numbers in binary).
dCode retains ownership of the "Bitwise Calculator" source code. Any algorithm for the "Bitwise Calculator" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Bitwise Calculator" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Bitwise Calculator" or any other element are not public (except explicit open source licence). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Bitwise Calculator" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Bitwise Calculator on dCode.fr [online website], retrieved on 2025-12-04,