easyonlinecalculator

Hex Converter

Choose a direction, type a hexadecimal or decimal whole number, and see it in hex, decimal, binary and octal at once. Hex is shown in uppercase and in byte pairs, a 0x prefix is accepted, and negative values include a two's complement view.

Last updated November 4, 2026

Digits 0-9 and A-F, with or without 0x. A leading minus sign is fine.

Result

FF hex = 255 decimal

The number in hexadecimal, decimal, binary and octal
Hexadecimal0xFF
Hex in bytesFF
Decimal255
Binary11111111
Binary in groups of 41111 1111
Octal377
Bit count8
Hex digit reference
HexDecimalBinary
000000
110001
220010
330011
440100
550101
660110
770111
881000
991001
A101010
B111011
C121100
D131101
E141110
F151111
Show the work

Formula: decimal = sum of (digit × 16^position)

  1. Read FF as a hexadecimal number. Letters A to F are the values 10 to 15.
  2. Multiply each digit by 16 to the power of its position, counting from 0 on the right: F (15) × 16 = 240; F (15) × 1 = 15.
  3. Add the products: 255 in decimal.
  4. Check with binary: each hex digit is 4 bits, 1111 1111, which is 11111111 in binary.

Result: FF hex = 0xFF hex = 255 decimal

How hexadecimal converts to decimal and back

Formula

decimal = sum of (digit × 16^position), positions counted from 0 on the right

decimal to hex: divide by 16 repeatedly and read the remainders upward

Hexadecimal is base 16. It needs sixteen digits, so after 0 to 9 it borrows the letters A to F for the values 10 to 15. The places are worth 1, 16, 256, 4096 and so on, each sixteen times the one to its right.

To turn hex into decimal, multiply each digit by its place value and add. For 1A the left digit is in the 16s place and the right in the 1s place, so 1 × 16 + 10 × 1 = 26.

To go the other way, divide the decimal number by 16 and note the remainder, then repeat with the quotient until it is 0. Read the remainders from last to first. For 255, the first division gives 15 remainder 15, and the quotient 15 gives 0 remainder 15, so the digits are F and F.

See how we calculate for the formulas, sources and review schedule behind every calculator.

Also useful alongside this calculator: Basic Calculator, Roman Numerals Converter and Square Root Calculator.

Why programmers use hex

Sixteen is 2 to the power of 4, so one hex digit is exactly four bits and two digits are one byte. That makes hex a compact way to write binary: 11111111 is FF, and 10100101 is A5. The bytes view in the results splits a value into these pairs, so 3735928559 reads as DE AD BE EF.

You meet hex in color codes, where #FF5733 means red FF (255), green 57 (87) and blue 33 (51), in memory addresses, and in byte dumps and checksums.

The 0x prefix and letter case

Many languages write hex with a 0x in front, such as 0xFF. Type the value with or without it; the converter strips a leading 0x and treats lowercase and uppercase letters alike, so ff, Ff and FF are the same number. Results are shown in uppercase with the prefix.

Spaces and underscores are ignored, so you can paste DE AD BE EF or 0xDEAD_BEEF as written.

Negative numbers and two's complement

A leading minus sign is kept in front of the digits: -255 is -0xFF. This signed-magnitude form is the plain mathematical answer.

Computers usually store negative integers as two's complement, where the value is taken modulo 2 to the power of the width. For a negative decimal number that fits, the results add 8, 16 and 32-bit views. For -2 that is FE, FFFE and FFFFFFFE; for -1 it is FF, FFFF and FFFFFFFF.

A number that does not fit a width, such as -200 in 8 bits, is simply omitted for that width.

How this differs from the binary converter

The Binary Converter accepts any base from 2 to 36. This page is built around hex: a direction toggle, uppercase output, byte pairs, a digit reference table and the two's complement view. Use the Binary Converter when you need an unusual base.

How to use the Hex Converter

  1. Pick a direction: hexadecimal to decimal, or decimal to hexadecimal.
  2. Type the number. For hex, digits 0 to 9 and A to F work, with or without 0x; a minus sign is allowed in both directions.
  3. Read the hex, bytes, decimal, binary and octal results. A negative value also shows its 8, 16 and 32-bit two's complement.
  4. Open Show the work to see the place values or the divisions for your number.
  5. Use Copy, Print or Share to keep the result.

Worked example: hex and decimal side by side

Worked example

Take hex 1F4. The places give 1 × 256 + 15 × 16 + 4 × 1 = 256 + 240 + 4 = 500. Going back, 500 ÷ 16 = 31 remainder 4, then 31 ÷ 16 = 1 remainder 15 (F), then 1 ÷ 16 = 0 remainder 1, and the remainders read upward are 1, F, 4.

Common values in hex, decimal and binary
HexDecimalBinary
A101010
FF25511111111
100256100000000
1F4500111110100
CAFE519661100101011111110
FFFF655351111111111111111

Frequently asked questions

How do I convert hex to decimal?

Multiply each hex digit by 16 to the power of its position, counting from 0 on the right, and add the products. For 1A that is 1 × 16 + 10 = 26.

How do I convert decimal to hex?

Divide by 16 repeatedly, keep each remainder, and read the remainders from last to first. Remainders 10 to 15 are written A to F, so 255 becomes FF.

Do I need to type the 0x prefix?

No. The converter accepts hex with or without a leading 0x and ignores letter case. The result is shown in uppercase with the prefix.

How are negative hex numbers handled?

A minus sign stays in front of the digits, so -255 is -0xFF. For negative values that fit, the 8, 16 and 32-bit two's complement forms are listed as well, such as -1 being FF, FFFF and FFFFFFFF.

How large a number can it convert?

Values up to 256 characters are converted exactly using whole-number arithmetic. For example, 2 to the power of 64 is 10000000000000000 in hex and 18446744073709551616 in decimal.