Roman Numeral Converter (1–3999)
Convert between Roman numerals and Arabic integers (1–3999). Strict subtractive-form validation — flags malformed numerals like IIII or VC.
Result
- Length7 letters
- DecompositionM · CM · XC · IV
Step-by-step
- Greedy from largest to smallest, emitting the subtractive form (CM, CD, XC, XL, IX, IV) whenever it fits.
- Result: MCMXCIV = M(1000)CM(900)XC(90)IV(4).
How to use this calculator
- Pick a direction. The active input box updates accordingly.
- Arabic → Roman: type any whole number 1–3999.
- Roman → Arabic: type uppercase letters from I V X L C D M. The validator rejects malformed strings.
- Read the breakdown row for the digit-by-digit decomposition.
About this calculator
The Roman number system survives today on clock-faces, copyright dates, monarch numbers, and Super Bowl branding. The classical written form uses seven letters (I, V, X, L, C, D, M) and the subtractive-pair shorthand (IV = 4, IX = 9, XL = 40, XC = 90, CD = 400, CM = 900). This converter goes both ways and validates strictly: malformed numerals like IIII, VV, or IL are rejected with a reason. The Arabic side accepts integers 1–3999, the upper bound of classical Roman notation before the overline-bar (M̄ = 1,000,000) takes over.
How it works — the formula
arabic → roman: greedy emit (M=1000, CM=900, D=500, CD=400, C=100, XC=90, L=50, XL=40, X=10, IX=9, V=5, IV=4, I=1)
roman → arabic: walk letters; subtract if next > current, else addThe standard subtractive form is regular enough to recognise with a single regex (^M{0,3}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$) and convert via a 13-entry greedy table.
Worked examples
- Inputs:
- arabic = 1994
- Output:
- MCMXCIV (M + CM + XC + IV)
- Inputs:
- arabic = 2026
- Output:
- MMXXVI
- Inputs:
- roman = MCMLXXVII
- Output:
- arabic 1977
Limitations
- Classical range only: 1–3999. No support for the overline-bar form used in early modern manuscripts for 4000+.
- Strict subtractive validation: archaic forms like IIII, VC, IL are rejected.
- No support for zero or negative integers.
Conversion is exact and reversible: arabicToRoman(romanToArabic(r)) returns the canonical form of r.