Home

binarytodecimalhex

Binary, decimal, and hexadecimal are numeral systems used in computing. Binary is base-2, using digits 0 and 1; decimal is base-10, using digits 0 through 9; hexadecimal is base-16, using digits 0–9 and letters A–F. Converting among these bases is a common task in programming, digital design, and debugging.

Binary to decimal is done by summing the products of each bit with its power of two.

Binary to hexadecimal can be done by grouping bits in fours from the right. Each group converts

Decimal to binary uses repeated division by 2, collecting remainders. For 13, the result is 1101_2. Decimal

Hexadecimal to binary is obtained by translating each hex digit to a four-bit binary sequence. FF_16 becomes

Notes: leading zeros are sometimes added for alignment, but do not change value. In computing, binary and

For
example,
1101_2
equals
1×2^3
+
1×2^2
+
0×2^1
+
1×2^0
=
8
+
4
+
0
+
1
=
13.
to
a
single
hex
digit.
For
instance,
1011
0101_2
equals
B5_16
(since
1011
is
B
and
0101
is
5).
to
hexadecimal
uses
repeated
division
by
16;
for
255,
the
result
is
FF_16.
1111
1111_2.
Hexadecimal
to
decimal
is
evaluated
as
a
base-16
value:
FF_16
equals
15×16
+
15
=
255.
hex
representations
are
often
used
for
low-level
data,
while
signed
numbers
may
require
awareness
of
bit
width
and
representations
such
as
two’s
complement.