255₁₀ → hex — number base conversion

corethe byte boundary

Answer

FF

Why this example is worth doing

Two hundred and fifty-five is the largest unsigned eight-bit value, and it is FF in hex and 1111 1111 in binary — three ways of writing an all-ones byte. The page uses it to anchor the boundary values a student should recognise on sight: FF, 7F as the largest signed byte, 80 as the most negative, and 100 as the first value that does not fit. Recognising these saves time in every later exercise.

Try your own input in the Binary ⇄ decimal ⇄ hex ⇄ octal. Convert between any two bases, integers and fractions, with the positional working.

How the answer is reached

Base 10 to base 16

Convert 255 from base 10 to base 16. The sign is carried across unchanged; only the magnitude is converted.

Positional expansion of the input — Base 10 to base 16
digitvalueweightweight (base 10)digit x weight
2210^2100200
5510^11050
5510^015
total255

Integer part: divide by 16 and read the remainders bottom to top.

Read the last column bottom to top. ↑ — Base 10 to base 16
ndivide byquotientremainder
255255 ÷ 1615F
1515 ÷ 160F

255 (base 10)FF (base 16)

Compare with

Open this example in the Binary ⇄ decimal ⇄ hex ⇄ octal

The field arrives filled in with this example’s input.

Note:

Notation this page assumes

  • Bit strings are written most significant bit first, and bit 0 is the least significant bit.
  • A width is stated explicitly wherever it changes the answer; nothing is silently sign-extended or truncated.
  • Fractions are converted digit by digit and shown to a stated number of places rather than rounded silently.

Sources

  • Knuth, The Art of Computer Programming, Vol. 2, §4.1 “Positional Number Systems” (1997)
  • IEEE 754-2019, Standard for Floating-Point Arithmetic