Math & Engineering
Hex Calculator
Convert numbers between decimal, hexadecimal, binary, and octal number systems.
Reviewed by the calculator.uk.com Team · Last reviewed 12 July 2026 · Our methodology
Enter a number to see conversions
Related to Hex Calculator
The Hex Calculator is a versatile tool that converts numbers between different number systems: decimal (base-10), hexadecimal (base-16), binary (base-2), and octal (base-8). It provides instant conversions and supports both positive and negative integers.
Number Systems
• Decimal (base-10): Uses digits 0-9
• Hexadecimal (base-16): Uses digits 0-9 and letters A-F
• Binary (base-2): Uses only 0 and 1
• Octal (base-8): Uses digits 0-7
Conversion Process
The calculator first converts the input number to decimal (base-10), then converts it to other bases using standard mathematical algorithms. For example, to convert decimal 123 to hexadecimal, it divides by 16 repeatedly and collects the remainders in reverse order, resulting in 0x7B.
The calculator displays the input number converted to all four number systems. Each result has a specific prefix to indicate its base:
Number Prefixes
• Decimal: No prefix (e.g., 123)
• Hexadecimal: 0x prefix (e.g., 0x7B)
• Binary: 0b prefix (e.g., 0b1111011)
• Octal: 0o prefix (e.g., 0o173)
Common Applications
• Hexadecimal: Used in programming, memory addresses, and color codes
• Binary: Used in digital electronics and computer operations
• Octal: Used in some computer systems and file permissions
1. What is hexadecimal notation?
Hexadecimal is a base-16 number system that uses sixteen distinct symbols: the numbers 0-9 and the letters A-F. Each hexadecimal digit represents four binary digits, making it a convenient way to represent binary-coded values in a more compact form.
2. Why are letters A-F used in hexadecimal?
Since hexadecimal is base-16, it needs 16 different digits (0-15). The numbers 0-9 cover the first ten digits, and letters A-F are used to represent the values 10-15. This convention was chosen because these letters are easy to distinguish and remember.
3. What are the prefixes 0x, 0b, and 0o used for?
These prefixes are used to indicate the number system being used. 0x indicates hexadecimal, 0b indicates binary, and 0o indicates octal. They help avoid ambiguity when working with numbers in different bases. For example, 10 in decimal is different from 0x10 in hexadecimal (which equals 16 in decimal).
4. Where are these number systems commonly used?
Different number systems are used in various computing and engineering contexts. Hexadecimal is commonly used in programming for memory addresses and color codes (e.g., #FF0000 for red). Binary is fundamental to digital electronics and computer operations. Octal is used in some Unix/Linux systems for file permissions.
5. What is the scientific source for this calculator?
Number bases are converted using the standard mathematics of positional numeral systems — where each digit's value depends on its position and the base it's written in — the same principle used for decimal, binary, octal, and hexadecimal notation throughout computer science. The calculator relies on JavaScript's built-in parseInt and toString methods, which implement this base-conversion logic directly rather than any floating-point or hardware-specific standard.