Hex Calculator — Free Online Hexadecimal Converter and Arithmetic
Convert between hexadecimal, decimal, and binary numbers and perform hex arithmetic including addition, subtraction, and multiplication.
Conversion Results
Hex to Decimal
0x1A3F = 6719
Hex to Binary
0x1A3F = 1101000111111
Decimal to Hex
6719 = 0x1A3F
Decimal to Binary
6719 = 1101000111111
How to Use the Hex Calculator
- Select the operation: Use the dropdown to choose between number system conversion and three arithmetic operations (addition, subtraction, multiplication). The conversion mode handles hex, decimal, and binary simultaneously.
- For conversions: Enter a hexadecimal number (using digits 0-9 and letters A-F) in the first field to see its decimal and binary equivalents. Enter a decimal number in the second field to see its hex and binary equivalents. Both inputs work independently and update in real time.
- For arithmetic: Enter two hexadecimal numbers in the input fields. Each value's decimal equivalent is shown below the input for reference. The result appears in hexadecimal, decimal, and binary formats.
- Read the results: The results panel shows the hex result prominently, with the decimal and binary equivalents below. For conversions, all three number system representations are displayed together.
- Verify your work: The decimal representation serves as an easy verification — you can mentally check the decimal arithmetic to confirm the hex result is correct.
Hex input is case-insensitive — you can enter "ff", "FF", or "Ff" and all are treated identically. The display normalizes to uppercase for consistency with standard hex conventions.
Hexadecimal Conversion Formulas
Hex to Decimal
D = h(n) x 16^n + h(n-1) x 16^(n-1) + ... + h(1) x 16 + h(0) x 1 Decimal to Hex
Repeatedly divide by 16, read remainders bottom-to-top (10=A ... 15=F) Hex to Binary
Replace each hex digit with its 4-bit binary equivalent Hex Digit Values
0-9 = 0-9, A=10, B=11, C=12, D=13, E=14, F=15 Variables Explained
- h(n), h(n-1), ..., h(0): The individual hexadecimal digits, where h(0) is the rightmost (least significant) digit. Each digit has a value from 0 to 15.
- 16^n: The positional weight of each hex digit. From right to left: 1, 16, 256, 4096, 65536, and so on (powers of 16).
- D: The decimal (base-10) equivalent of the hexadecimal number.
Step-by-Step Example
Convert hex 1A3F to decimal:
- Identify positional values: 16^3=4096, 16^2=256, 16^1=16, 16^0=1
- Map hex digits: 1=1, A=10, 3=3, F=15
- Multiply and sum: 1x4096 + 10x256 + 3x16 + 15x1
- Calculate: 4096 + 2560 + 48 + 15 = 6719
Hex 1A3F = decimal 6719. In binary, this is 0001 1010 0011 1111 (each hex digit maps to 4 binary bits: 1=0001, A=1010, 3=0011, F=1111). This 4:1 mapping between binary and hex is what makes hexadecimal so useful in computing.
Practical Examples
Example 1: Claire's CSS Color Mixing
Claire is a web designer who wants to find the average of two colors for a gradient midpoint. She needs to average #4488CC (a medium blue) with #CC8844 (a warm orange).
- Red: avg(0x44, 0xCC) = avg(68, 204) = 136 = 0x88
- Green: avg(0x88, 0x88) = avg(136, 136) = 136 = 0x88
- Blue: avg(0xCC, 0x44) = avg(204, 68) = 136 = 0x88
- Result: #888888 (a neutral gray)
The average of the blue and orange is a neutral gray — this makes sense because the colors are roughly complementary. Hex arithmetic is essential for color manipulation in CSS, graphic design, and digital art. Each two-digit hex pair represents a channel value from 00 (0) to FF (255).
Example 2: Ryan's Memory Address Calculation
Ryan is debugging a program and needs to calculate a memory offset. The base address is 0x7F000000 and the offset is 0x1A40.
- Base: 0x7F000000 = 2,130,706,432 in decimal
- Offset: 0x1A40 = 6,720 in decimal
- Target: 0x7F000000 + 0x1A40 = 0x7F001A40
- Decimal: 2,130,706,432 + 6,720 = 2,130,713,152
Ryan finds the target address is 0x7F001A40. In systems programming, hex makes memory addresses far more readable than decimal. A 32-bit address is only 8 hex digits but up to 10 decimal digits. Most debuggers, disassemblers, and memory inspection tools display addresses in hexadecimal by default.
Example 3: Diana's Unicode Investigation
Diana is working on internationalization and needs to understand the Unicode code point for the Euro sign. She looks up that it is U+20AC and wants to understand what this means numerically.
- Hex: 20AC
- Decimal: 2x4096 + 0x256 + 10x16 + 12x1 = 8192 + 0 + 160 + 12 = 8,364
- Binary: 0010 0000 1010 1100
- UTF-8 encoding: E2 82 AC (three bytes)
The Euro sign is the 8,364th code point in Unicode. Its UTF-8 encoding requires 3 bytes because it falls in the range U+0800 to U+FFFF. Understanding hex is essential for working with character encodings, file formats, and protocols that use hex notation extensively.
Hex-Decimal-Binary Reference Table
| Hex | Decimal | Binary | Use Case |
|---|---|---|---|
| 0A | 10 | 00001010 | Newline character (LF) |
| 20 | 32 | 00100000 | Space character (ASCII) |
| 41 | 65 | 01000001 | Letter 'A' (ASCII) |
| FF | 255 | 11111111 | Maximum byte value |
| FFFF | 65,535 | 1111111111111111 | Max 16-bit value |
| FF0000 | 16,711,680 | 111111110000000000000000 | CSS Red (#FF0000) |
| 7FFFFFFF | 2,147,483,647 | 01111...1 (31 ones) | Max signed 32-bit int |
Tips and Complete Guide
Hex Digit Memorization
Memorize the hex-to-decimal mapping for rapid mental conversion: A=10, B=11, C=12, D=13, E=14, F=15. Also memorize key powers of 16: 16^1=16, 16^2=256, 16^3=4096, 16^4=65536. With these memorized, you can convert small hex numbers mentally. For example, hex B7 = 11x16 + 7 = 176 + 7 = 183. The hex-to-binary mapping is equally important: just convert each hex digit to its 4-bit pattern.
Hex in Web Development
Web developers encounter hex daily through CSS color codes. The format #RRGGBB uses two hex digits per color channel. To lighten a color, increase each channel toward FF; to darken, decrease toward 00. To desaturate, make all three channels more equal. CSS also supports 8-digit hex (#RRGGBBAA) for alpha transparency, where AA ranges from 00 (fully transparent) to FF (fully opaque). Understanding hex arithmetic helps you manipulate colors programmatically without relying on color picker tools.
Hex in Systems Programming
In systems programming, hex is the standard notation for memory addresses, register values, and binary file contents. Debuggers display raw memory in hex dumps — rows of hex bytes like "48 65 6C 6C 6F" (which spells "Hello" in ASCII). Error codes, hardware port addresses, and CPU instruction opcodes are all communicated in hex. Even at the application level, UUIDs (like 550e8400-e29b-41d4-a716-446655440000) use hex digits for compact representation of 128-bit values.
Hex and Cryptography
Cryptographic hashes are almost always displayed in hex. An MD5 hash is 32 hex characters (128 bits), SHA-256 is 64 hex characters (256 bits), and SHA-512 is 128 hex characters (512 bits). Encryption keys, digital signatures, and certificate fingerprints all use hex representation. When you see "SHA-256: e3b0c44298fc1c149..." in a security context, those are hex digits representing the binary hash output.
Common Mistakes to Avoid
- Mixing up hex and decimal digits: The string "10" in hex means 16 in decimal, not 10. Always use the 0x prefix or explicitly state the base to avoid confusion. When in doubt, our calculator shows both representations side by side.
- Forgetting that hex uses A-F: Valid hex digits are 0-9 and A-F only. Letters G-Z are not valid hex digits. Our calculator rejects invalid characters and shows a clear error state.
- Carrying errors in hex addition: When hex digits sum to more than F (15), carry 1 to the next column. A+8=18 decimal=12 hex (write 2, carry 1). This is analogous to decimal carrying at 10, but occurs at 16.
- Confusing hex color channels: In #RRGGBB, the first pair is red, second is green, third is blue. A common mistake is reversing the order. Remember: RGB left to right, just like the abbreviation.
- Case sensitivity assumptions: Hex digits A-F can be uppercase or lowercase — "ff" and "FF" and "Ff" all represent the same value (255). However, some systems have conventions about case. Our calculator normalizes to uppercase.
Frequently Asked Questions
Hexadecimal is a base-16 number system that uses 16 symbols: 0-9 for values zero through nine, and A-F for values ten through fifteen. Each hex digit represents exactly 4 binary bits, making hex a compact way to represent binary data. For example, hex FF equals decimal 255 (15x16 + 15) and binary 11111111. Hex is widely used in computing for memory addresses, color codes (#FF0000 for red), and byte-level data representation.
Multiply each hex digit by its positional power of 16 and sum the results. For hex 2A3: 2x16^2 + Ax16^1 + 3x16^0 = 2x256 + 10x16 + 3x1 = 512 + 160 + 3 = 675. Remember that A=10, B=11, C=12, D=13, E=14, F=15. Our calculator performs this conversion instantly and also shows the binary equivalent.
Repeatedly divide by 16 and record the remainders (using A-F for remainders 10-15), then read the remainders from bottom to top. For decimal 750: 750/16=46 R14(E), 46/16=2 R14(E), 2/16=0 R2. Reading bottom-to-top: 2EE. So decimal 750 = hex 2EE. Verify: 2x256 + 14x16 + 14x1 = 512 + 224 + 14 = 750.
Each hex digit maps to exactly 4 binary digits (bits), making conversion straightforward. To convert hex to binary, replace each hex digit with its 4-bit binary equivalent: 0=0000, 1=0001, ..., 9=1001, A=1010, B=1011, C=1100, D=1101, E=1110, F=1111. For example, hex 3F = 0011 1111 = binary 00111111. To convert binary to hex, group bits into sets of 4 from the right and convert each group. Use our <a href='/math/number-systems/binary-calculator' class='text-primary-600 hover:text-primary-800 underline'>binary calculator</a> for binary operations.
Add hex digits column by column, carrying to the next column when the sum exceeds 15 (F). For example, hex A + 7 = 17 decimal = 11 hex (write 1, carry 1). Adding hex FF + 1A: F+A = 25 decimal = 19 hex (write 9, carry 1), F+1+1 = 17 decimal = 11 hex (write 1, carry 1). Result: 119 hex = 281 decimal. Our calculator handles all hex arithmetic and shows the decimal verification.
The 0x prefix (or 0X) is a convention used in programming languages like C, C++, Java, Python, and JavaScript to indicate that a number is hexadecimal, not decimal. For example, 0xFF means hex FF (decimal 255), not the string 'FF'. Without this prefix, it would be ambiguous whether '10' means decimal 10 or hex 10 (decimal 16). Some systems use a # prefix (CSS colors like #FF0000) or an h suffix (assembly language like FFh).
Hex is popular in programming because it provides a compact, human-readable way to represent binary data. One hex digit equals exactly 4 bits, so two hex digits represent one byte (8 bits), and 8 hex digits represent a 32-bit value. This is much easier to read than 32 binary digits. Common uses include memory addresses (0x7FFFFFFF), RGB color values (#00FF80), Unicode code points (U+00E9), error codes, and low-level debugging. Most programming debuggers display memory contents in hex.
CSS hex colors use the format #RRGGBB where each pair of hex digits represents a color channel (Red, Green, Blue) with values from 00 (0) to FF (255). For example, #FF0000 is pure red (R=255, G=0, B=0), #00FF00 is pure green, #0000FF is pure blue, #FFFFFF is white, and #000000 is black. CSS also supports shorthand (#F00 = #FF0000) and alpha transparency (#RRGGBBAA, where AA controls opacity from 00 to FF).
Related Calculators
Binary Calculator
Convert between binary and decimal, perform binary arithmetic operations.
GCF Calculator
Find the Greatest Common Factor of two or more numbers using the Euclidean algorithm.
Factor Calculator
Find all factors, factor pairs, and determine if a number is prime or composite.
Scientific Calculator
Advanced calculations with trigonometry, logarithms, and scientific functions.
Percentage Calculator
Calculate percentages, percentage change, and more with five operation modes.
Grade Calculator
Calculate weighted grades and GPA across multiple assignments and courses.
Disclaimer: This calculator is for informational and educational purposes only. Results are estimates and may not reflect exact values.
Last updated: February 23, 2026
Sources
- Khan Academy — Number Systems: khanacademy.org
- Math is Fun — Hexadecimal Numbers: mathsisfun.com
- Purplemath — Number Bases: purplemath.com