About Hexadecimal & Binary Number Systems
What is Hexadecimal (Base-16)?
Hexadecimal, commonly called "hex," is a base-16 positional numeral system. It uses sixteen distinct symbols: the digits
0β9
to represent values zero to nine, and the letters
AβF
(or
aβf
) to represent values ten to fifteen. A single hex digit can represent 16 different values, equivalent to exactly 4 binary bits (a nibble).
Hex is widely used in computing because it provides a compact, readable representation of binary data. For example, the 8-bit value
11111111
in binary is simply
FF
in hex β much shorter and easier to read.
What is Binary (Base-2)?
Binary is the fundamental language of all digital computers. It is a base-2 numeral system that uses only two digits:
0
(off/false/low) and
1
(on/true/high). These correspond directly to the two states of a transistor β the physical building block of all modern processors and memory chips.
Every piece of data β text, images, sound, video β is ultimately stored and processed as sequences of 0s and 1s. A byte is 8 binary bits, capable of representing values from
00000000
(0) to
11111111
(255).
Octal (Base-8)
Octal uses digits
0β7
. It was historically used in computing (e.g., Unix file permissions like
chmod 755
). Each octal digit maps to exactly 3 binary bits, making conversion straightforward. Today it is less common than hex, but still encountered in legacy systems and certain programming contexts.
Decimal (Base-10)
Decimal is the number system we use in everyday life. It uses digits
0β9
and is base-10, meaning each position represents a power of 10. Computers internally work in binary, but decimal is used as the human-readable interface. Converting between decimal and binary/hex is a core skill in programming and computer science.
Complete Hex to Binary Conversion Table (0βFF)
This table covers all single-byte values from
0
to
FF
(0 to 255 in decimal). Each hex digit pair maps to one byte of 8 binary bits.
| Hex | Binary | Decimal | Octal | Hex | Binary | Decimal | Octal |
|---|
How to Convert Hex to Binary (Step-by-Step Guide)
Converting hexadecimal to binary manually is straightforward once you know the key rule: every hex digit maps to exactly 4 binary bits. Follow these steps:
-
Write your hex number.
Example:
3B7F -
Split it into individual digits.
β
3,B,7,F -
Look up (or recall) the 4-bit binary for each digit:
3 = 0011,B = 1011,7 = 0111,F = 1111 -
Concatenate all 4-bit groups in order:
0011 1011 0111 1111 -
Your result is:
0011101101111111(binary for 3B7F hex, or 15231 decimal)
How to Convert Binary to Hex
The reverse process is equally simple:
- Group the binary digits into sets of 4, starting from the right. Pad with leading zeros if needed.
- Convert each 4-bit group to its hex digit.
-
Example:
10111010β1011=B,1010=AβBA
How to Convert Decimal to Binary
Use repeated division by 2. Divide the number by 2, record the remainder (0 or 1), and repeat with the quotient until you reach 0. Then read the remainders from bottom to top.
Example:
13 Γ· 2 = 6 r1
β
6 Γ· 2 = 3 r0
β
3 Γ· 2 = 1 r1
β
1 Γ· 2 = 0 r1
β Result:
1101
π‘ Memory Tip: FACE
Remember F = 1111, A = 1010, C = 1100, E = 1110 . These four cover most tricky hex digits. The numeric digits 0β9 follow their natural binary pattern.
π‘ The 0x Prefix
In programming, hex values are often prefixed with
0x
(e.g.,
0xFF
). This is convention in C, C++, Java, Python, and JavaScript. This tool accepts values with or without the prefix.
π‘ Nibble vs Byte
A nibble = 4 bits = 1 hex digit. A byte = 8 bits = 2 hex digits. A word = 16 bits = 4 hex digits. A dword = 32 bits = 8 hex digits.
π‘ Hex in HTML Colors
HTML colors like
#FF5733
use 3 hex pairs for Red, Green, Blue channels.
FF
= max intensity (255),
00
= zero. So
#FF0000
is pure red.
Real-World Uses of Hexadecimal in Computing
Hexadecimal is not just a theoretical concept β it appears everywhere in software development, networking, and hardware engineering:
-
HTML/CSS Color Codes:
Colors are specified as
#RRGGBBhex triplets.#FFFFFF= white,#000000= black,#FF5733= orange-red. -
Memory Addresses:
Debuggers and disassemblers display memory addresses in hex (e.g.,
0x7FFFFFFF). This is because modern CPUs use 32-bit or 64-bit addresses, which are far easier to read as hex than as binary or decimal. -
IPv6 Addresses:
IPv6 uses eight groups of four hex digits, such as
2001:0db8:85a3:0000:0000:8a2e:0370:7334. - Cryptographic Hashes: SHA-256 produces a 256-bit hash displayed as 64 hex characters. MD5 produces 128 bits (32 hex characters).
-
Unicode Code Points:
Characters are identified by hex code points:
U+1F600is π,U+0041is 'A'. -
Machine Code & Assembly:
Opcodes and operands in x86 assembly are written in hex (e.g.,
B8 01 00 00 00=MOV EAX, 1). - Network Packets: Packet analyzers like Wireshark display raw packet bytes as hex dumps.
-
File Magic Numbers:
File formats are identified by their first bytes: PDF files start with
25 50 44 46(which is%PDFin ASCII), PNG files start with89 50 4E 47.
Common Hex Values Quick Reference
These are the most frequently encountered hex values in programming, networking, and hardware contexts.
| Hex Value | Binary | Decimal | Common Meaning |
|---|---|---|---|
| 0x00 | 00000000 | 0 | Null / Zero / Off |
| 0x01 | 00000001 | 1 | Minimum positive value / True (sometimes) |
| 0x0F | 00001111 | 15 | Lower nibble mask |
| 0x7F | 01111111 | 127 | Max signed 8-bit integer |
| 0x80 | 10000000 | 128 | Min signed 8-bit integer (negative) |
| 0xFF | 11111111 | 255 | Max unsigned byte / white in color channel |
| 0x100 | 100000000 | 256 | First 9-bit value / one more than a byte |
| 0xFFFF | 1111111111111111 | 65535 | Max unsigned 16-bit integer |
| 0xFFFFFFFF | 32Γ 1s | 4294967295 | Max unsigned 32-bit integer |
| 0xDEADBEEF | 11011110β¦ | 3735928559 | Famous debug/magic number in software |
| 0xCAFEBABE | 11001010β¦ | 3405691582 | Java class file magic number |
| 0xBAADF00D | 10111010β¦ | 3131961357 | Microsoft debug heap magic number |
Frequently Asked Questions
Replace each hex digit with its 4-bit binary equivalent. Use the table: 0=0000, 1=0001, 2=0010, 3=0011, 4=0100, 5=0101, 6=0110, 7=0111, 8=1000, 9=1001, A=1010, B=1011, C=1100, D=1101, E=1110, F=1111. Then concatenate all groups. For example, hex
FA
β F=1111, A=1010 β binary
11111010
.
A nibble is a group of exactly 4 binary bits. Since a single hex digit represents values 0β15 (0000β1111 in binary), one hex digit = one nibble. Two nibbles = one byte (8 bits). The term "nibble" is a playful reference to it being half a byte.
0xFF
in binary is
11111111
. It is 255 in decimal. This is the maximum value of one unsigned byte. In RGB color codes,
FF
means full intensity for a color channel.
One hex digit represents exactly 4 bits (a nibble). This is because hex is base-16, and 2β΄ = 16. Two hex digits = 8 bits (1 byte). Four hex digits = 16 bits (1 word). Eight hex digits = 32 bits (1 dword).
DEADBEEF
in binary is
11011110 10101101 10111110 11101111
. D=1101, E=1110, A=1010, D=1101, B=1011, E=1110, E=1110, F=1111. Its decimal value is 3,735,928,559. It is a famous "magic number" used by developers to mark uninitialized memory regions.
Hexadecimal is used because each hex digit maps exactly to 4 binary bits, making it a compact shorthand for binary. A 32-bit memory address that would take 32 characters in binary only needs 8 hex characters. It is also easier for humans to read and type than long binary strings, while being directly convertible to binary without arithmetic.
Binary (base-2) uses only 0 and 1 and is the native language of computers. Hexadecimal (base-16) uses 0β9 and AβF and serves as a compact human-readable shorthand for binary. One hex digit replaces four binary digits. Binary is used by hardware; hex is used by programmers to read and write binary data more conveniently.
The
0x
prefix is a convention in many programming languages (C, C++, Java, Python, JavaScript) to indicate that the number following it is in hexadecimal base. For example,
0xFF
means hex FF (decimal 255). The
0x
distinguishes hex literals from decimal numbers in source code.
Group the binary digits into groups of 4 from right to left, padding the leftmost group with leading zeros if needed. Then convert each 4-bit group to its hex digit. Example: binary
10111010
β groups
1011
and
1010
β hex
BA
.
Yes β this tool converts any hex value within JavaScript's safe integer range (up to 2β΅Β³β1, or about 16 quadrillion). For extremely large cryptographic values (e.g., 256-bit SHA hashes), use the bulk convert mode which handles multiple values at once. Use the Text β Hex/Bin tab to convert entire ASCII strings character by character.
| HEX | BIN | DEC |
|---|