Roman Numeral Converter
Enter a number from 1 to 3,999 to get its Roman numeral, broken down by thousands, hundreds, tens and ones.
Roman numeral
MMXXIV
By place value
thousands 2000 = MM; tens 20 = XX; ones 4 = IV
Number of letters
6
How it works
Roman numerals build a number from seven letters: I = 1, V = 5, X = 10, L = 50, C = 100, D = 500 and M = 1,000. Letters are written from largest to smallest and added up, so MDCLXVI is 1,000 + 500 + 100 + 50 + 10 + 5 + 1 = 1,666. A letter is never repeated more than three times in a row, and V, L and D are never repeated at all.
To avoid IIII, the standard form uses subtraction for 4 and 9 in each place: a smaller letter placed before a larger one is taken away from it. Only six such pairs are allowed, IV (4), IX (9), XL (40), XC (90), CD (400) and CM (900). Each pair acts as a single symbol, which gives the thirteen symbol values the converter works with: 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1.
Converting is a greedy process: take the largest of the thirteen values that fits, write its symbol, subtract it, and repeat until nothing is left. Because the symbol values are chosen so that no place ever needs more than three repeats of a letter, the greedy result is always the standard form. Equivalently, convert each decimal place on its own: 2,024 is 2,000 (MM) + 20 (XX) + 4 (IV).
Standard Roman numerals have no zero and no symbol above M, so the conventional range is 1 to 3,999 (MMMCMXCIX). Larger numbers used an overline to multiply by 1,000, which this converter does not produce.
Formula
symbols: 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 greedy: while n > 0: take the largest symbol value v ≤ n, append its symbol, n = n − v by place: thousands (M × 1–3) + hundreds (C, CD, D, CM) + tens (X, XL, L, XC) + ones (I, IV, V, IX)
Example
2,024: the largest value that fits is 1,000, twice (MM, leaving 24); then 10 twice (XX, leaving 4); then 4 (IV). Result: MMXXIV, six symbols. By place: thousands 2,000 = MM; tens 20 = XX; ones 4 = IV.
1,987 is M (1,000) + CM (900) + L (50) + XXX (30) + VII (7) = MCMLXXXVII, and 3,999, the largest standard numeral, is MMMCMXCIX. 1,666 = MDCLXVI uses each of the seven letters exactly once, in descending order.
Assumptions and limitations
- Only the standard subtractive form is produced: IV not IIII, XC not LXXXX, and never IIX, VC or IM. Some clock faces and inscriptions use additive variants such as IIII; those are not generated.
- The range is 1 to 3,999. Roman numerals have no zero, no negatives and no fractions, and numbers of 4,000 and above need the overline (vinculum) notation that a plain text field cannot show.
- Converting a Roman numeral back to a number needs letter input, which this form does not have (its fields are numeric). To check a numeral, convert the number you think it is and compare.
Frequently asked questions
Why is 4 written IV and not IIII?
Both forms existed historically, and IIII is still common on clock faces, but the standard modern convention limits a letter to three repeats and uses subtraction for 4 and 9 in each place: IV, IX, XL, XC, CD, CM. This converter always produces that subtractive form, so 4 is IV, 40 is XL and 400 is CD.
How do I read a Roman numeral back into a number?
Scan left to right adding each letter's value, except that when a letter is immediately followed by a larger one, subtract it instead. MCMXCIV: M (+1000), CM (900 because C is before M), XC (90), IV (4) = 1,994. The six subtractive pairs IV, IX, XL, XC, CD and CM are the only places subtraction happens in standard numerals.
More in Math & Geometry calculators.