Roman numerals encode numbers using seven letters whose values are added or, in specific pairs, subtracted. This tool converts integers to Roman numerals and back, and it validates Roman input so malformed numerals are caught rather than silently misread.
The symbol reference
The seven symbols and their values:
| Symbol | Value |
|---|---|
| I | 1 |
| V | 5 |
| X | 10 |
| L | 50 |
| C | 100 |
| D | 500 |
| M | 1000 |
Six subtractive pairs extend the system: IV (4), IX (9), XL (40), XC (90), CD (400), CM (900). These six pairs are the only valid subtractions — no other combination is standard.
How the converter works
Number-to-Roman uses a greedy algorithm over a fixed value table that includes the six subtractive pairs. It repeatedly appends the largest numeral that does not exceed the remaining value:
1000 M 900 CM 500 D 400 CD
100 C 90 XC 50 L 40 XL
10 X 9 IX 5 V 4 IV 1 I
Roman-to-number scans the string from right to left: each symbol is added unless
it is smaller than the symbol to its right, in which case it is subtracted (so the
I in IX is subtracted). To guarantee the input was well-formed, the tool then
converts the result back to a canonical numeral and compares; if they differ — as
they would for IIII or IC — it reports the input as invalid and shows the
correct form.
Worked examples
The current year 2026 is MMXXVI: two thousands (MM), two tens (XX), a five (V),
and a one (I). A more complex case: 1999 is MCMXCIX — M (1000), CM (900), XC (90), IX (9). The subtractive rule keeps numerals short rather than writing MDCCCCXCIX.
| Number | Roman numeral | Breakdown |
|---|---|---|
| 4 | IV | 5 − 1 |
| 9 | IX | 10 − 1 |
| 40 | XL | 50 − 10 |
| 90 | XC | 100 − 10 |
| 400 | CD | 500 − 100 |
| 900 | CM | 1000 − 100 |
| 1999 | MCMXCIX | 1000 + 900 + 90 + 9 |
| 2026 | MMXXVI | 2000 + 20 + 5 + 1 |
Validation rules enforced
The validator enforces the real rules of the system: I, X, C, and M may repeat up to three times in a row, while V, L, and D may never repeat. IIII is invalid (write IV); VV is invalid (write X). Anything outside 1 to 3999, or any character beyond I, V, X, L, C, D, M, is rejected with an explanation and the correct form shown.