Programming & CS πŸ‡ΊπŸ‡Έ USA πŸ‡¬πŸ‡§ UK Live Results RGB Color Converter
Convert

Hex Calculator

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.

Hex Converter & Calculator

Live
Enter a hexadecimal value (0–9, A–F) to convert to decimal, binary, and octal instantly.
0x
Use digits 0–9 and letters A–F (case insensitive)
Hex digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
A=10, B=11, C=12, D=13, E=14, F=15
Enter two hex values and choose an operation. Results shown in hex and decimal.
0x
0x
Convert RGB values (0–255 each) to hex colour code, or enter a 6-digit hex code to get RGB values.
RGB β†’ Hex
Hex β†’ RGB
#

Results

β€”
Decimal Value
β€”
Enter a value above to convert
Hex Digit Values
Hex Nibble Distribution

Hexadecimal Guide

Guide

Hex Calculator – Complete Guide to Hexadecimal (USA & UK)

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.

What Is Hexadecimal?

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.

HexDecimalBinary
000000
550101
991001
A101010
F151111
FF25511111111
100040961000000000000

Why Do Programmers Use Hexadecimal?

Each hex digit represents exactly 4 binary bits (a nibble). This makes hex the perfect shorthand for binary data:

  • 1 hex digit = 4 bits
  • 2 hex digits = 1 byte (8 bits)
  • 4 hex digits = 2 bytes (16 bits)
  • 8 hex digits = 4 bytes (32 bits)

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.

Converting Hex to Decimal

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.

  • 1 Γ— 16Β² = 1 Γ— 256 = 256
  • A Γ— 16ΒΉ = 10 Γ— 16 = 160
  • 3 Γ— 16⁰ = 3 Γ— 1 = 3
  • Total = 256 + 160 + 3 = 419

Converting Decimal to Hex

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.

  • 255 Γ· 16 = 15 remainder 15 (F)
  • 15 Γ· 16 = 0 remainder 15 (F)
  • Result: FF

Hex Color Codes in Web Design

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).

ColourHex CodeRGB
White#FFFFFFrgb(255,255,255)
Black#000000rgb(0,0,0)
Red#FF0000rgb(255,0,0)
Pure Blue#0000FFrgb(0,0,255)
Amber#F59E0Brgb(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.

Memory Addresses and Hex

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.

Hexadecimal in Assembly Language

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 and MAC Addresses

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.

Hash Values and Cryptography

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.

Hex in UK and US Computing Education

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.

Two's Complement in Hex

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.

Frequently Asked Questions

How do you convert hex to decimal?

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.

What does 0x mean before a hex number?

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.

How are colours represented in hexadecimal?

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.

Why do programmers use hex instead of binary?

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.

What is a nibble?

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).

How are IPv6 addresses written in hex?

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.

Is hex in the UK GCSE Computer Science syllabus?

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.

What is a SHA-256 hash in hex?

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.

⚠️ Disclaimer

Important

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).

Decimal
β€”