Convert hexadecimal to decimal, binary, and octal. Perform hex arithmetic operations. Includes RGB colour code converter for web design and programming. Free for US and UK students and developers.
Hexadecimal (hex) is the number system most widely used by programmers and computer engineers. While binary is the native language of computer hardware, hex provides a compact, human-readable representation of binary data. Every memory address, colour code, error code, and cryptographic hash is routinely expressed in hexadecimal. This free hex calculator converts between hex, decimal, binary, and octal, performs hex arithmetic, and includes an RGB colour code converter for web designers.
Hexadecimal is a base-16 number system. Unlike decimal (base 10) which uses ten digits (0β9), hex uses sixteen symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. Letters A through F represent the decimal values 10 through 15.
| Hex | Decimal | Binary |
|---|---|---|
| 0 | 0 | 0000 |
| 5 | 5 | 0101 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| F | 15 | 1111 |
| FF | 255 | 11111111 |
| 1000 | 4096 | 1000000000000 |
Each hex digit represents exactly 4 binary bits (a nibble). This makes hex the perfect shorthand for binary data:
A 32-bit memory address like 0x0040FF14 is far easier to read and write than its 32-digit binary equivalent. This is why hex is universal in debugging, assembly language, firmware, and system programming.
Each hex digit is multiplied by 16 raised to its position power, starting from 0 on the right. Sum the results to get the decimal value.
Example: Convert 1A3 to decimal.
Divide the decimal number by 16 repeatedly, recording the remainder at each step. Remainders 10β15 are written as AβF. Read the remainders from bottom to top.
Example: Convert 255 to hex.
Web colours are specified as 6-digit hex codes in the format #RRGGBB, where RR is the red component, GG is green, and BB is blue. Each pair ranges from 00 (0 decimal, no colour) to FF (255 decimal, full colour).
| Colour | Hex Code | RGB |
|---|---|---|
| White | #FFFFFF | rgb(255,255,255) |
| Black | #000000 | rgb(0,0,0) |
| Red | #FF0000 | rgb(255,0,0) |
| Pure Blue | #0000FF | rgb(0,0,255) |
| Amber | #F59E0B | rgb(245,158,11) |
The CSS specification, SVG, HTML, and virtually every design tool uses hex colour codes. Understanding how to convert between RGB and hex is a fundamental web development skill.
Computer memory addresses are almost universally expressed in hexadecimal. A 32-bit address space spans 0x00000000 to 0xFFFFFFFF (4 GB of addressable memory). When debugging programs, crash reports and stack traces show hex memory addresses. Understanding hex is essential for system programmers, embedded developers, and security researchers.
Assembly language programs frequently use hex for machine code opcodes, register values, port addresses, and interrupt vectors. Intel x86 documentation expresses all opcodes in hex. For example, the NOP (No Operation) instruction is 0x90, the RET instruction is 0xC3, and the INT 3 debug breakpoint is 0xCC.
IPv6 addresses are 128 bits long and written as eight groups of four hex digits separated by colons: 2001:0db8:85a3:0000:0000:8a2e:0370:7334. MAC (Media Access Control) addresses are 48-bit hardware identifiers written as six pairs of hex digits: 00:1A:2B:3C:4D:5E. Both formats use hexadecimal as the human-readable representation of binary hardware identifiers.
Cryptographic hash functions (MD5, SHA-1, SHA-256) produce fixed-length binary outputs that are always displayed in hex. An SHA-256 hash is 256 bits = 32 bytes = 64 hex characters. Password hashes, file checksums, digital signatures, and SSL certificate fingerprints are all expressed in hex. Security professionals must be comfortable reading hex output from tools like hash calculators, Wireshark, and debuggers.
In the United Kingdom, hexadecimal is a required topic in GCSE Computer Science. Students must convert between binary, denary (decimal), and hexadecimal; understand why hex is used as a shorthand for binary; and apply these concepts to topics like colour representation, character encoding, and memory addressing.
In the United States, hexadecimal appears in AP Computer Science Principles (data representation unit), AP Computer Science A, and most introductory computer engineering courses. The Digital Electronics curriculum in US high schools covers hex arithmetic and conversion as foundational topics.
Signed integers in hex follow the same two's complement rules as binary, but in hex notation. For 8-bit numbers, values 0x00 to 0x7F represent 0 to 127 (positive), and 0x80 to 0xFF represent β128 to β1 (negative). The most significant bit (the left-most bit of the most significant byte) is the sign bit. 0x80 = 10000000 in binary = β128 in signed 8-bit.
Multiply each hex digit by 16 raised to its positional power (0 at right) and sum all values. For example, 1A = 1Γ16 + 10Γ1 = 26. Our hex calculator converts any hex value to decimal, binary, and octal instantly.
0x is the standard C/C++/Java prefix indicating a hexadecimal literal. For example, 0xFF = 255 decimal. In assembly language, hex numbers are sometimes suffixed with 'h' (FFh) or prefixed with $ ($FF) depending on the assembler.
Web colours use 6-digit hex codes (#RRGGBB). Each pair of hex digits represents one colour channel (red, green, blue) from 00 (none) to FF (maximum). #FF0000 is pure red, #00FF00 is pure green, #0000FF is pure blue, #FFFFFF is white, and #000000 is black.
Each hex digit represents exactly 4 binary bits, making hex a compact shorthand. A 32-bit binary number requires 32 characters but only 8 hex characters. Hex is also easier to read, group, and remember than long binary strings, making it ideal for memory addresses, colour codes, and byte-level data.
A nibble (sometimes spelled nybble) is 4 bits β exactly one hex digit. A byte (8 bits) consists of two nibbles: the upper nibble (high nibble) represents the first hex digit and the lower nibble represents the second. For example, 0xAB = 1010 (high nibble) + 1011 (low nibble).
IPv6 addresses are 128-bit numbers written as eight groups of four hex digits separated by colons: 2001:0db8:85a3:0000:0000:8a2e:0370:7334. Groups of all zeros can be compressed using ::. IPv6 was introduced because IPv4's 32-bit address space (roughly 4 billion addresses) was exhausted.
Yes. Hexadecimal is explicitly listed in GCSE Computer Science specifications from AQA, OCR, and Edexcel. Students must convert between binary, denary, and hex; explain why hex is used as shorthand for binary; and understand hex applications in colour codes, memory addressing, and error codes.
SHA-256 produces a 256-bit (32-byte) hash value. This is typically displayed as 64 hexadecimal characters. For example, the SHA-256 hash of "hello" is 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824. Each pair of hex characters represents one byte of the 32-byte hash output.
This calculator handles non-negative integers within JavaScript's safe integer range. For large cryptographic values, use a dedicated tool. Colour conversions are standard RGB/hex for web (sRGB colour space).