Hex calculator guide
The hexadecimal number system is a positional base-16 system. Its sixteen digits are 0–9 and A–F, where A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15. Each position is worth a power of 16 — 1, 16, 256, 4,096, and so on from right to left. Because 16 is 2⁴, every hex digit encodes exactly four binary bits, a grouping called a nibble. That 4-bit packing is why hex is the usual shorthand for machine bytes, memory addresses, and CSS color channels.
This calculator has two modes. Convert takes a single hex value (an optional 0x or 0X prefix is stripped) and reports the same integer in decimal, binary, and octal. Add, Subtract, Multiply, and Divide take two hex operands, evaluate them as integers, and show the hexadecimal result beside a decimal check. For binary (base-2) column arithmetic, use the binary calculator instead.
How to use this hex calculator
- Choose the operation: Select Convert to translate one hex value, or Add, Subtract, Multiply, or Divide to evaluate two hex operands. The active button is highlighted.
- Enter the hexadecimal number(s): Type digits 0–9 and A–F. An optional 0x or 0X prefix pasted from code is stripped automatically; other characters are removed. Convert uses a single field; arithmetic uses two.
- Select Calculate: Press Calculate to evaluate. Empty input, invalid digits such as G, more than 12 hex digits, or division by zero produce a descriptive error instead of a result.
- Read the conversion or the hex result: In Convert, the large value is the canonical hex form, with decimal, binary, and octal listed underneath. In arithmetic, the large value is the hex answer, followed by the same equation in decimal as a check.
- Reset or share: Reset restores FF and 0A. The current operation and operands are stored in the page URL so you can copy a link to the same calculation.
Formula and variables
Every hexadecimal string is evaluated as a sum of its digits multiplied by powers of 16. Letters A–F stand for the values 10–15. Because one hex digit is one nibble (4 bits), converting hex to binary is a digit-by-digit substitution rather than a full positional expansion: F₁₆ = 1111₂, 0₁₆ = 0000₂, and FF₁₆ = 11111111₂. Arithmetic then uses ordinary integer operations on those decimal values, with a carry in addition generated at 16 instead of 10. Division returns the mathematical floor of the quotient and discards any remainder.
N = dₙ×16ⁿ + … + d₂×16² + d₁×16¹ + d₀×16⁰, where each dᵢ ∈ {0,…,9,A,B,C,D,E,F}- N — Number value
- The integer value that the hexadecimal string represents. (unitless integer)
- dᵢ — Hexadecimal digit
- The digit at position i, counting from 0 at the rightmost place. Values 10–15 are written A–F. (0–9 or A–F)
- 16ⁱ — Positional weight
- The base-16 weight of position i. (power of sixteen)
- nibble — Four-bit group
- One hexadecimal digit, equal to 4 binary bits. (4 bits)
Worked example: convert FF₁₆ to decimal, binary, and octal
Convert the default hexadecimal value FF (often written 0xFF in code) using positional notation and the nibble shortcut, the same method the calculator applies.
- Hexadecimal number
- FF
- Operation
- Convert
- Expand by place value: FF₁₆ = (F × 16¹) + (F × 16⁰).
- Replace letters: F = 15, so (15 × 16) + (15 × 1) = 240 + 15 = 255 in decimal.
- Nibble shortcut to binary: F = 1111, so FF = 1111 1111 = 11111111₂.
- Convert 255 to octal by grouping bits in threes: 011 111 111₂ = 3 7 7₈ = 377₈.
Result: FF₁₆ = 255₁₀ = 11111111₂ = 377₈
FF is the largest unsigned 8-bit value, which is why a CSS color channel and a byte both range from 00 to FF (0 to 255). The same identity is the default conversion on this page.
Understanding your results
Conversion results
The large monospace value is the hexadecimal input with any 0x prefix removed and letters uppercased. Decimal is the integer N from the positional formula. Binary is that integer written in base 2 (each hex digit is one nibble of 4 bits). Octal is the same integer in base 8.
Arithmetic results
The large value is the answer in uppercase hex with no 0x prefix. A leading minus sign appears when subtraction produces a negative integer. The decimal check restates the same equation so you can confirm the operands and the result in base 10.
Division results
Hexadecimal division returns only the integer quotient; any fractional remainder is discarded with Math.floor. For example, A ÷ 3 (10 ÷ 3) returns 3. The default pair FF + 0A is 255 + 10 = 265 in decimal, which is 109 in hex.
Assumptions
- Operands are whole (non-negative integer) hexadecimal numbers using digits 0–9 and A–F, with an optional 0x or 0X prefix.
- Each operand has at most 12 hex digits and must be exactly representable as a safe integer.
- Division returns the mathematical floor of the quotient with the remainder discarded.
- Negative results from subtraction are shown with a leading minus sign rather than two’s-complement notation.
Limitations
- Fractional hex numbers (values with a radix point, such as A.8) are not supported.
- Bitwise AND, OR, XOR, shifts, and fixed-width overflow behavior are outside the scope of this calculator.
- Division does not report the remainder separately; only the floored integer quotient is shown.
- Strings longer than 12 hex digits, or values that cannot be represented exactly, are rejected rather than approximated.
- Binary (base-2) column arithmetic is not performed here; use the binary calculator for that.
Common mistakes
- Typing the letter G or any character outside 0–9 and A–F; those are not hexadecimal digits.
- Reading a hex result as if it were decimal — 10 in hex is sixteen, not ten, and 0A is ten.
- Forgetting that a carry in hex addition happens at 16, not at 10 as in decimal arithmetic.
- Confusing a nibble (4 bits, one hex digit) with a byte (8 bits, two hex digits).
- Expecting a fractional answer from hex division; the calculator keeps only the whole-number quotient.
- Treating a leading minus sign as two’s-complement machine representation; this page uses sign-and-magnitude.
Practical use cases
Check hex homework and conversions
Verify FF = 255 = 11111111₂ = 377₈, or expand a longer value by powers of 16, then use the decimal check to confirm the digits were transcribed correctly.
Read code literals, colors, and addresses
Paste a 0x-prefixed constant, a two-digit color channel, or a short memory offset and read the decimal and binary forms. Each pair of hex digits is one byte; each single digit is one nibble.
Add and subtract hex quantities
The default arithmetic example FF + 0A is 255 + 10 = 265 decimal, written 109 in hex. Use the same decimal check for subtraction, multiplication, and integer division.
Planning and decision guide
Use the nibble shortcut for hex ↔ binary
Memorize the sixteen 4-bit patterns: 0 = 0000 through F = 1111. Converting hex to binary (or back) is then a per-digit substitution and does not require expanding powers of 16. Convert FF this way and you immediately get 11111111.
Choose the binary calculator for base-2 arithmetic
This page converts a hex value into binary and performs arithmetic in base 16. If you need to add, subtract, multiply, or divide two binary strings such as 1010 and 11, open the binary calculator, which is built for base-2 column operations.
Remember that hex division discards the remainder
If you need the remainder from a division, compute it separately as dividend − divisor × quotient. For 10₁₆ ÷ 2₁₆ the quotient is 8 and the remainder is 0. For A₁₆ ÷ 3₁₆ the quotient is 3 and the remainder is 1.
Frequently asked questions
What is the hexadecimal number system?
It is a positional base-16 system that uses the sixteen digits 0–9 and A–F (A = 10 through F = 15). Each position is worth a power of 16, so the rightmost digit is 1, the next is 16, then 256, 4,096, and so on.
Why is hexadecimal used in computing?
Base 16 is compact for binary data because one hex digit is exactly one nibble (4 bits) and two hex digits are one byte (8 bits). FF is 255, the largest unsigned 8-bit value, which is why color channels, machine bytes, and many memory listings are written in hex.
What is a nibble?
A nibble is a group of 4 bits. Because 2⁴ = 16, each hexadecimal digit maps onto one nibble: 0 = 0000, 9 = 1001, A = 1010, F = 1111. Concatenating those nibbles converts hex to binary without extra arithmetic.
How do I convert hex to decimal?
Multiply each digit by 16 raised to its position (rightmost is 16⁰) and add. FF = 15×16 + 15×1 = 255. Letters A–F represent 10–15. The Convert mode performs this expansion and also reports binary and octal.
Can I paste values with a 0x prefix?
Yes. A leading 0x or 0X is stripped, so 0x10 is the same as 10 in hex, which is 16 in decimal. Digits after the prefix still have to be 0–9 and A–F.
What is FF + 0A in hexadecimal?
FF is 255 and 0A is 10, so the decimal check is 255 + 10 = 265. 265 in hex is 109, because 1×256 + 0×16 + 9 = 265. That pair is the default arithmetic example on this calculator.
Why does hex division drop the fractional part?
This calculator performs integer division: it returns only the whole-number quotient (the floor of the true quotient). For example, 10₁₆ ÷ 2₁₆ = 8, and A₁₆ ÷ 3₁₆ = 3.
Why does the calculator reject the letter G?
Hexadecimal stops at F (15). G is not a base-16 digit, so the string is invalid and is flagged with an error instead of producing a misleading result.
Where can I add and subtract binary numbers?
Use the binary calculator for base-2 arithmetic on strings of 0s and 1s. This hex calculator will show the binary form of a hex value, but it does not perform column operations in base 2.
Sources and review
- Hexadecimal — MathWorld — A Wolfram Resource. Accessed 2026-08-23.
- Hexadecimal numbers — Khan Academy. Accessed 2026-08-23.
- Hexadecimal Numbering Systems — Electronics Tutorials. Accessed 2026-08-23.
- parseInt() — MDN Web Docs. Accessed 2026-08-23.
Reviewed 2026-08-23.