Roman Numeral Converter
Convert Roman numerals to numbers and back, with malformed numerals refused rather than guessed at.
Runs entirely in your browser. Nothing is uploaded, logged or stored.
Roman numeral
MCMXCIV
- Number
- 1994
- How it adds up
- M = 1000 + CM = 900 + XC = 90 + IV = 4
Roman numerals turn up on clock faces, in film credits, on monuments and in chapter numbers, and they are easy to read wrongly by one letter. This converts either way and refuses anything ill-formed rather than guessing at it.
How it works
Writing a number is greedy: take the largest value that fits — M, CM, D, CD, C, XC and so on down to I — subtract it, repeat. That produces the canonical numeral, the one where subtraction is used only in the six places it is allowed.
Reading is the same rule in reverse, then checked. The numeral is summed the usual way, and the result is written back out; if the two do not match, the input was not well formed. That single check rejects IIII, VX, IC and every other malformed shape without needing a rule for each.
Examples
| Case | Input | Result |
|---|---|---|
| A year with two subtractions in it | MCMXCIV | 1994 — M + CM + XC + IV |
| The other direction | 2026 | MMXXVI |
| Refused, because it is not how 4 is written | IIII | rejected |
Frequently asked questions
Why is IIII refused when clock faces use it?
Because clock faces are a typographic tradition rather than the notation. IIII appears on dials for balance against VIII across the face, and almost nowhere else. Accepting it here would mean accepting IIIII and VIIII too, and then the notation has no rules left.
Why does it stop at 3999?
Because there is no agreed way to write four thousand. The classical answer is an overline meaning times a thousand, which is a typographic mark rather than a letter, and the alternative of repeating M is not a standard. Refusing is more honest than picking one.
Is there a zero?
No. The system has no symbol for it and no place value that would need one. Scribes who had to write nothing wrote the word nulla.
Which subtractions are allowed?
Only six: IV, IX, XL, XC, CD and CM — that is, I before V or X, X before L or C, and C before D or M. IC for 99 is not one of them; 99 is XCIX.
Good to know
- Malformed numerals are refused rather than interpreted. IIII, IC and VX all have an obvious intended meaning, and reporting it would mean saying a numeral means something it does not say.
- The range is 1 to 3999. There is no zero in the system, and no agreed notation above 3999 that can be written as plain letters.