Roman Numeral Converter Formula

Understand the math behind the roman numeral converter. Each variable explained with a worked example.

Formulas Used

Thousands Digit

thousands = floor(value / 1000)

Hundreds Digit

hundreds = floor(mod(value, 1000) / 100)

Tens Digit

tens = floor(mod(value, 100) / 10)

Ones Digit

ones = mod(value, 10)

Variables

VariableDescriptionDefault
valueNumber (1-3999)2024

How It Works

Roman Numeral Converter

Roman Numeral Chart

| Decimal | Roman | |---------|-------| | 1 | I | | 5 | V | | 10 | X | | 50 | L | | 100 | C | | 500 | D | | 1000 | M |

Digit Mapping

  • Thousands: 1=M, 2=MM, 3=MMM
  • Hundreds: 1=C, 2=CC, 3=CCC, 4=CD, 5=D, 6=DC, 7=DCC, 8=DCCC, 9=CM
  • Tens: 1=X, 2=XX, 3=XXX, 4=XL, 5=L, 6=LX, 7=LXX, 8=LXXX, 9=XC
  • Ones: 1=I, 2=II, 3=III, 4=IV, 5=V, 6=VI, 7=VII, 8=VIII, 9=IX
  • Break down your number into digits and look up each group.

    Worked Example

    Convert 2024 to Roman numerals.

    value = 2024
    1. 01Thousands = 2 → MM
    2. 02Hundreds = 0 → (nothing)
    3. 03Tens = 2 → XX
    4. 04Ones = 4 → IV
    5. 05Result: MMXXIV

    Ready to run the numbers?

    Open Roman Numeral Converter