Roman Numeral Converter
Convert numbers to Roman numerals and Roman numerals back to numbers, with a validity check.
Draft — figures checked, awaiting an editorial read. Not indexed.
Formula: Greedy subtraction against the value table M, CM, D, CD, C, XC, L, XL, X, IX, V, IV, I produces the canonical numeral.
What this calculates
This converts numbers into Roman numerals and back. The reverse direction also checks whether the numeral you entered is correctly formed, which is more useful than it sounds — Roman numerals have real rules, and plenty of the numerals you see in the wild break them. The system has no zero and no way to write anything above 3,999 using the standard letters, which is a genuine limitation rather than an arbitrary cap: the overline notation for larger values was never standardised well enough to implement reliably.
How it works
Number to numeral uses greedy subtraction against a value table that includes the subtractive pairs — CM for 900, CD for 400, XC for 90, XL for 40, IX for 9 and IV for 4. Taking the largest value that fits, repeatedly, always produces the canonical form. The reverse direction reads left to right, subtracting any symbol smaller than the one after it and adding otherwise. The validity check then converts the parsed number back to a numeral and compares: if the round trip does not match, the input was non-standard, which catches things like IIII or the impossible VX.
Worked example
Converting 2026: take M (1000) twice for MM, leaving 26. X (10) twice gives XX, leaving 6. V (5) gives V, leaving 1. I gives I. The result is MMXXVI. Reading it back: M+M = 2000, X+X = 2020, V = 2025, I = 2026, with no subtractive pairs since each symbol is worth at least as much as the one after it.
Common mistakes
Writing IIII for 4 instead of IV. It is technically readable, appears on many clock faces by long tradition, and is not the canonical form — which is why the validity check flags it. Second, inventing subtractive pairs: only I before V or X, X before L or C, and C before D or M are legitimate. IL for 49 is not valid; it is XLIX. Third, expecting a zero — the system has none, which is exactly why it was eventually replaced for arithmetic.
Common questions
- How do you write 2026 in Roman numerals?
- MMXXVI. Two thousands, two tens, a five and a one.
- Why is 4 written IV and not IIII?
- The subtractive rule: a smaller symbol before a larger one is subtracted, so IV is 5 − 1. IIII appears on many clock faces for tradition and visual balance, but IV is the standard form.
- What is the largest Roman numeral?
- MMMCMXCIX, which is 3,999. Larger values needed an overline to multiply a symbol by a thousand, and that notation was never consistently standardised.