Convert decimal to hexadecimal (base‑16), hex to decimal, binary, and octal — with step-by-step division, byte grouping, all-bases view, and RGB color preview. 100% free, no login.
This is the complete reference table for all decimal values 0 to 255 with their hexadecimal, binary, and octal equivalents. This range covers the full single-byte value space — the most commonly encountered range in color codes, ASCII, networking, and low-level programming.
| Decimal | Hex | Binary | Octal | Decimal | Hex | Binary | Octal |
|---|
Use the converter above for values beyond 255 or for reverse conversion (hex → decimal).
Hexadecimal is a positional numeral system with a base of 16. Like decimal (base 10) uses ten digits (0–9), hexadecimal uses sixteen symbols: the digits 0 through 9 and the letters A through F, where A represents 10, B represents 11, C represents 12, D represents 13, E represents 14, and F represents 15.
In any positional number system, each digit's value is the digit multiplied by the base raised to the power of its position (counting from 0 on the right). In hexadecimal, each position is a power of 16:
| Position | Power of 16 | Value | Example digit | Contribution |
|---|---|---|---|---|
| Rightmost (0) | 16⁰ | 1 | B (=11) | 11 × 1 = 11 |
| Second from right (1) | 16¹ | 16 | A (=10) | 10 × 16 = 160 |
| Third from right (2) | 16² | 256 | 3 | 3 × 256 = 768 |
| Fourth from right (3) | 16³ | 4096 | 1 | 1 × 4096 = 4096 |
So
13AB
in hex = 4096 + 768 + 160 + 11 =
5035 in decimal
.
Computers operate in binary (base 2), using only 0s and 1s. Binary numbers become very long very quickly — the decimal number 255 requires 8 binary digits (
11111111
). Hexadecimal provides a compact shorthand: every 4 binary bits map to exactly one hex digit, and every 8 bits (1 byte) map to exactly two hex digits. This makes hex the natural language for expressing memory addresses, machine code, color values, cryptographic hashes, and network addresses.
| Hex digit | Decimal value | 4-bit binary |
|---|---|---|
| 0 | 0 | 0000 |
| 1 | 1 | 0001 |
| 2 | 2 | 0010 |
| 3 | 3 | 0011 |
| 4 | 4 | 0100 |
| 5 | 5 | 0101 |
| 6 | 6 | 0110 |
| 7 | 7 | 0111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
The standard method for converting a decimal integer to hexadecimal is repeated division by 16 . Here are three worked examples at different scales.
FF
1000
FF0000
Multiply each hex digit by 16 raised to the power of its position and sum the results:
FF
= (F × 16¹) + (F × 16⁰) = (15 × 16) + (15 × 1) = 240 + 15 =
255
1A3B
= (1 × 4096) + (A × 256) + (3 × 16) + (B × 1) = 4096 + 2560 + 48 + 11 =
6715
FFFFFF
= (F × 65536×15) + ... =
16777215
Hexadecimal is used throughout computing, networking, graphics, and software development. Understanding hex is essential for any programmer, sysadmin, or digital designer.
All CSS hex colors follow the
#RRGGBB
format. Each two-digit hex pair represents one color channel (0–255). Example:
#1A2B3C
= R:26, G:43, B:60. Shorthand
#RGB
is also valid.
CPU memory addresses are expressed in hex in debuggers, disassemblers, and system logs. Example:
0x7FFE4A00
is a typical stack address. Hex is standard in GDB, LLDB, WinDbg, and all memory profilers.
Hex literals appear in code across all major languages. In C/C++/Java/JavaScript/Python:
0xFF
,
0x1A3B
. They're used for bitmasks, flags, hardware registers, and protocol constants.
SHA-256, MD5, and all common hash algorithms output hex strings. A SHA-256 hash is 64 hex characters (256 bits = 32 bytes = 64 hex digits). Example:
a665a45920422f9d417e4867efdc4fb8
.
IPv6 addresses are written in hex groups:
2001:0db8:85a3:0000
. MAC (Ethernet) addresses are 6 bytes in hex:
00:1A:2B:3C:4D:5E
. IPv4 is sometimes expressed as a single hex value.
Every binary file format begins with a "magic number" in hex. JPEG files start with
FF D8 FF
, PNG with
89 50 4E 47
, PDF with
25 50 44 46
. Hex editors use these to identify file types.
CPU opcodes and machine code are written in hex. x86 assembly instruction encodings, ARM opcodes, and microcontroller register values are all expressed as hex bytes in datasheets and firmware.
Game engines store color values, flags, item IDs, and save file data in hex. Cheat codes and memory editors work directly with hex addresses and values in game memory.
Computers use multiple number systems for different purposes. Here is a comparison of the four most important bases used in computing.
| Property | Decimal (Base 10) | Hexadecimal (Base 16) | Binary (Base 2) | Octal (Base 8) |
|---|---|---|---|---|
| Digits used | 0–9 | 0–9, A–F | 0, 1 | 0–7 |
| Base | 10 | 16 | 2 | 8 |
| Bits per digit | ~3.32 bits | 4 bits (exact) | 1 bit (exact) | 3 bits (exact) |
| Digits to represent 255 | 3 (255) | 2 (FF) | 8 (11111111) | 3 (377) |
| Prefix in code | none | 0x | 0b | 0 or 0o |
| Common uses | Everyday numbers, human I/O | Colors, addresses, hashes | CPU logic, bitwise ops | Unix permissions, legacy |
| Hex Value | Decimal | Significance |
|---|---|---|
| 0x00 | 0 | Null byte / minimum single byte value |
| 0x0A | 10 | ASCII newline character (LF) |
| 0x1F | 31 | Last ASCII control character |
| 0x20 | 32 | ASCII space character |
| 0x41 | 65 | ASCII uppercase 'A' |
| 0x61 | 97 | ASCII lowercase 'a' |
| 0x7F | 127 | ASCII DEL character / max 7-bit value |
| 0xFF | 255 | Maximum single-byte value |
| 0x100 | 256 | First value requiring 2 bytes (9 bits) |
| 0xFFFF | 65535 | Maximum 16-bit unsigned integer |
| 0xFFFFFF | 16777215 | Maximum 24-bit value / max RGB color |
| 0xFFFFFFFF | 4294967295 | Maximum 32-bit unsigned integer |
Answers to the most common questions about hexadecimal numbers, conversion methods, and this tool.
0x
prefix is a convention used in C, C++, Java, JavaScript, Python, and many other programming languages to indicate that the following number is in hexadecimal (base 16). For example,
0xFF
is the hex literal for 255, and
0x1A3B
is the hex literal for 6715. Without the prefix, the compiler would interpret the value as decimal. Python also accepts
0b
for binary and
0o
for octal.
#RRGGBB
where RR is the red channel, GG is green, and BB is blue — each a two-digit hex value from 00 (decimal 0) to FF (decimal 255). For example:
#FF0000
is pure red (R=255, G=0, B=0),
#00FF00
is pure green,
#0000FF
is pure blue,
#FFFFFF
is white,
#000000
is black. A 4-digit
#RGBA
and 8-digit
#RRGGBBAA
format also exists with an alpha transparency channel. The 3-digit shorthand
#RGB
doubles each digit:
#F00
=
#FF0000
.
B
= 1011,
A
= 1010, so
BA
hex =
10111010
binary. Similarly, to go from binary to hex, group the binary digits into 4-bit groups from right to left and convert each group to its hex digit.
Explore more free online tools from IndexCraft for number conversion and text processing.