๐Ÿงฐ UtlKit

How to Convert Roman Numerals: 1,994 Becomes MCMXCIV, 2,026 Becomes MMXXVI, and 3,999 Is the Last Number the System Can Write

One field, both directions: 1,994 becomes MCMXCIV, MCMXCIV comes back as 1994, the strict pattern refuses IL, IC, and XXXXII, and MMMM still slips through.

The roman numeral converter takes one field and works in both directions at once. Type 1994 and it answers MCMXCIV; type MCMXCIV, lowercase or with spaces between the letters, and it answers 1994. The result card shows the Arabic number and the Roman numeral side by side, each with its own copy button, and a reference table below lists the seven base symbols: I is 1, V is 5, X is 10, L is 50, C is 100, D is 500, M is 1,000.

How a number breaks down

The converter walks a 13-step table from largest to smallest: M (1,000), CM (900), D (500), CD (400), C (100), XC (90), L (50), XL (40), X (10), IX (9), V (5), IV (4), I (1), and appends each symbol as many times as it fits. For 1,994 that is M for 1,000, CM for 900, XC for 90, and IV for 4: MCMXCIV. The year 2,026 becomes MM, then XX, then VI: MMXXVI. The placeholder example 42 lands on XL then II: XLII.

The six subtractive pairs

Only six subtractions are legal: IV (4), IX (9), XL (40), XC (90), CD (400), CM (900). The validator is a strict pattern over the canonical order, so 49 is XLIX, never IL; 99 is XCIX, never IC; and 44 is XLIV, because four X in a row like XXXXII breaks the rule that a symbol may repeat at most three times. VV, IIII, and XM are rejected the same way: the pattern checks that the M block, then the C-or-D block, then the X-or-L block, then the I-or-V block each appear in descending order and nothing else.

The range, and its one loophole

An Arabic number must be a whole integer between 1 and 3,999; 0 and 4,000 both get the range error. 3,999 is the largest canonical Roman numeral, and it writes MMMCMXCIX: three M, then CM, then XC, then IX. The loophole: Roman-numeral input has no upper bound at all. The pattern lets any run of M through, so MMMM parses to four thousand and MMMMM to five thousand, even though no Arabic input could ever produce either string.

What the field accepts

The field first tries to read the text as a whole number, and only if the text equals that number exactly does it convert. A 42 with stray spaces on both sides works because the text is trimmed first, but 42.0 fails: it parses to 42, the two strings differ, so the text is instead treated as a Roman numeral and rejected. 1,994 with its comma behaves the same way. On the Roman side, letter case and inner spaces do not matter: mcmxciv and m c m x c i v both return 1994.

Where the number goes

Roman numerals survive on year plates, chapter markers, and clock faces, so 2,026 becomes MMXXVI on a diploma or a title card. MCMXCIV is seven characters where 1994 is four; the character counter makes that length difference concrete. Reversing the letters with the text reverser gives VICXMCM, which the converter refuses, a quick demo of how strict the order rules are. The number base converter covers the other side of number systems, with 1994 as 11111001010 in binary and 7CA in hexadecimal, and the morse code tool is the closest cousin: another scheme that spells values out of a small fixed alphabet.

Related reading

The caesar rot13 tool is the other classic from the Roman era, shifting each letter by a fixed amount instead of composing a number from symbols. For another ratio-flavored how-to, see how to calculate an aspect ratio, and for the text-side cleanup step, see how to use a string escape tool.

Related Tools

Frequently Asked Questions

Why does the Arabic input stop at 3,999?

3,999 is the largest number the canonical Roman system can write: three M for 3,000, then CM, then XC, then IX, spelling MMMCMXCIX. The 4,000 place has no base symbol, so the tool returns a range error instead of inventing one. The Roman side, however, accepts any run of M, so MMMM still reads as 4,000 even though no Arabic input could ever produce it.

Why is 49 written XLIX and never IL?

Only six subtractive pairs are legal: IV, IX, XL, XC, CD and CM. The I may subtract only from the V and the X above it, so an I in front of an L is not a recognized pattern. XLIX is XL (40) plus IX (9); the strict validator rejects IL because the blocks must stay in descending order: X-then-L before I-then-V.

Does the converter work in both directions?

Yes. The single field auto-detects: if the text is exactly a whole number, it runs the Arabic path; anything else goes to the Roman path. Type 1994 and the card shows MCMXCIV; type MCMXCIV, in any case and with or without spaces, and the card shows 1994. Both directions round-trip cleanly: MCMXCIV back through the converter returns 1994.

What happens with 0, 4,000, or 42.0?

0 and 4,000 both land on the range error, because the Arabic side is a whole integer between 1 and 3,999 only. 42.0 is the subtle one: it parses to the number 42, but the text 42.0 is not the same string as 42, so the field stops treating it as a number and instead hands it to the Roman validator, which rejects it as an invalid Roman numeral. The error is an invalid-input error, not a range error.

What if you reverse the letters of a Roman numeral?

You get a string the validator refuses. Reverse MCMXCIV and it reads VICXMCM: the pattern demands the M-block first, then the C-or-D block, then the X-or-L block, then the I-or-V block, all descending. VICXMCM starts with V, which belongs to the smallest block, so the whole string fails the pattern and the converter returns the invalid-numeral error instead of a number.

Related Articles