Home

Bitwise

Bitwise refers to operations that directly manipulate data at the level of bits, the most basic units of information in digital systems. Bitwise operations are foundational for low‑level programming and digital logic, enabling precise control over individual bits within integers or binary data.

The core bitwise operators are AND, OR, XOR, and NOT, along with bit shifts such as left

Common uses include masking, setting, clearing, or toggling specific bits; testing whether particular bits are set;

Bitwise operations are efficient and widely supported across languages such as C, C++, Java, and Python. They

See also: bit masking, bit field, bit rotation.

shift
and
right
shift.
In
many
programming
languages
these
are
represented
by
symbols
such
as
&,
|,
^,
~,
<<,
and
>>,
with
some
languages
offering
an
unsigned
right
shift
as
>>>.
Bitwise
operations
are
typically
applied
to
integer
types,
though
some
languages
also
allow
them
on
booleans.
and
combining
multiple
bit
flags
into
a
single
value.
For
example,
5
&
3
equals
1,
5
|
3
equals
7,
and
5
^
3
equals
6.
Bit
shifts
move
bits
left
or
right,
for
instance
3
<<
1
equals
6
and
3
>>
1
equals
1.
The
NOT
operator
inverts
bits
(subject
to
the
width
and
representation
of
integers,
which
affects
the
exact
result
in
two’s
complement
systems).
are
central
to
tasks
like
bit
masking,
packing
data
into
compact
forms,
implementing
bit
fields,
and
algorithms
that
rely
on
binary
manipulations.
Limitations
include
dependence
on
integer
width
and
signed
representations,
which
can
affect
results
for
NOT
and
right
shifts.