Most people will tell you that four is IV and that IIII is a mistake. Yet no Roman authority ever wrote that rule down, and many clock dials still show IIII without anyone thinking the clockmaker got it wrong. So who decided what a "correct" Roman numeral looks like, and why does the system run out at 3999?

In short, the rules most of us learned are a modern convention. Puzzle setters, programmers and web standards wrote them down, not the Romans. The same convention decides what a strict converter accepts and what it rejects.

Seven letters and no rulebook

The system uses seven signs (Britannica, Wikipedia):

Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1000

Where the signs came from is less certain. The usual explanation is that they grew out of tally marks, cut as notches on sticks, and that the Romans took over earlier Etruscan numerals. Britannica also mentions the idea that V stands for an open hand and X for two Vs joined at the points, but it presents this as an interpretation. Treat all of these as the common reading, not as settled fact.

What matters for the rest of this article is that Roman numerals are not positional. In 2024, the first 2 means two thousand because of where it sits, and the 0 is there only to hold a place. In a Roman numeral, X means ten wherever it appears. Position decides only whether a symbol is added or subtracted, and that is why the system can work without a zero (MathWorld describes it as additive-subtractive).

Adding came first, subtracting was optional

The oldest and simplest way to write a Roman numeral is to add symbols together. Four is IIII and nine is VIIII. Subtractive forms such as IV and IX also appear in ancient and later writing, but no one applied them consistently. Britannica and Wikipedia both describe a long stretch in which additive and subtractive spellings existed side by side, and neither form was compulsory.

Clock dials are the best-known survivor of the additive habit, since many still show IIII. The usual explanations are tradition and visual balance against the VIII on the opposite side. Stories about a particular king who insisted on IIII are anecdotes, not documented history.

Spellings such as IIX for 8 or MDCCCCX for 1910 come from the same flexible practice. A modern reader may call them wrong, but that is a judgement made by today's convention. A Roman reader would have understood them without difficulty.

Project Euler, the programming puzzle site, draws this line clearly. Its page on Roman numeral rules sets out a deliberately loose definition of a valid numeral: symbols run in descending order, D, L and V appear at most once, and smaller symbols may not equal or exceed M, C or X. It also restricts subtraction to the same pairs as the strict form (I before V and X, X before L and C, C before D and M), so its rules differ from the strict form mainly in allowing repeats such as IIII. Under those rules IIII and VIIII count as valid. The page then describes a separate "minimal form", the shortest valid spelling, and points out that minimal form was not itself a rule.

That gives two separate ideas:

  • "Valid", in the loose sense, means a person can read it and arrive at one number.
  • "Canonical" means it is the single form that a particular modern convention picks for that number.

IIII is valid in the first sense. It is not canonical. Here is how a few historical spellings compare with the canonical form, and what a strict checker does with each:

Historical spelling Canonical form Converter in the Roman → Number direction
IIII IV rejects IIII, reads IV as 4
VIIII IX rejects VIIII, reads IX as 9
IIX VIII rejects IIX, reads VIII as 8
MDCCCCX MCMX rejects MDCCCCX, reads MCMX as 1910

The modern convention: six subtractive pairs

The form taught in schools and expected by software is stricter than Project Euler's validity rules in one respect, the repetition limit:

  • Write symbols from largest to smallest.
  • Subtraction is allowed only through six pairs: IV (4), IX (9), XL (40), XC (90), CD (400) and CM (900).
  • Only I, X and C may be subtracted, and each only from the next two larger symbols: I from V and X, X from L and C, C from D and M.
  • No symbol repeats more than three times in a row, so four is IV rather than IIII.

So 99 is XCIX, not IC. 49 is XLIX, not IL. 1999 is MCMXCIX, not MIM. Forms such as VX or XM are never used.

This strict form is the one built into the CSS table below and into the validation pattern taught in Dive Into Python 3. The three-repeat habit is old: Project Euler's rules page notes that avoiding more than three identical numerals in a row had become standard practice by medieval times. It was a habit, though, not a law.

The W3C CSS Counter Styles specification, which tells browsers how to number lists, defines upper-roman with a fixed 13-entry table:

1000 M    900 CM    500 D    400 CD
 100 C     90 XC     50 L     40 XL
  10 X      9 IX      5 V      4 IV
   1 I

The table is just the seven basic signs plus the six subtractive pairs. Programmers and browser makers share this convention. Roman numerals have no standards body of their own, and the closest thing to a normative definition on the web is this CSS table.

Where 3999 comes from

In the strict modern form, no symbol repeats more than three times and there is no symbol larger than M. The largest numeral you can build is therefore MMM for the thousands followed by the largest form for each lower place: MMMCMXCIX, which is 3999. Writing 4000 would need MMMM, which the strict form does not allow.

Software reaches the same number by different routes. CSS does not derive the limit from a repetition rule. It states it directly: upper-roman and lower-roman have a range of 1 to 3999, and outside that range a counter falls back to decimal (W3C, MDN). An ordered list styled with Roman markers switches to plain digits once it passes item 3999. The validation pattern shown later gets the limit from M{0,3}, which allows at most three thousands. These are separate decisions that happen to agree.

The Roman numeral converter uses the same 1 to 3999 range in both directions. Inside that range, every whole number has exactly one canonical numeral and every canonical numeral has exactly one value.

Larger numbers were written in other ways. A bar over a numeral, the vinculum, multiplied its value by 1,000 (Wikipedia, MathWorld). Other notations built large values from I and C-shaped curves facing both ways. None of these became a single agreed system. Unicode encodes several of the archaic forms in its Number Forms block, including ↀ (one thousand), ↁ (five thousand), ↂ (ten thousand) and the reversed C, Ↄ. The converter supports none of these extensions.

No zero, no negatives, no fractions

The system has no symbol for zero. Modern conventions start at 1: the CSS range does, and so does the encoding task on Rosetta Code. Since the system works without place values, it never needed a zero to hold an empty column.

Negative numbers do not exist in the system either. That is why the converter rejects 0 and anything below it. Fractions also fall outside the I-to-M set described here, and the converter works with whole numbers only.

Writing a numeral: why a 13-row table is enough

Turning a number into its canonical numeral needs only the 13-row table and one rule: take the largest value that fits, write its symbol, subtract that value, and repeat until nothing is left. The CSS specification calls this an additive counter system and defines it in exactly this way. The converter's Number → Roman direction uses the same greedy pass over the same table.

Why is this enough? For the hundreds, tens and units, the table contains the symbols for 1, 4, 5 and 9 times that place; the thousands have only M, which is why they stop at MMM. Values of 2, 3, 6, 7 and 8 come from repeating or combining them, such as III or VIII. Every value in one place is also larger than any amount the lower places can hold, so the greedy pass finishes the thousands before it reaches the hundreds, and so on down. In effect, each decimal digit turns into its own short block of Roman symbols.

Here is the trace for 1994:

1994  take 1000 → M      remaining 994
 994  take 900  → CM     remaining 94
  94  take 90   → XC     remaining 4
   4  take 4    → IV     remaining 0

result: M + CM + XC + IV = MCMXCIV

The other common method looks up each digit in a small table: one row each for thousands, hundreds, tens and units. Rosetta Code has many versions of both approaches. They produce identical output, because they are two ways of writing down the same rule.

One side effect is that length tells you nothing about size. 3999 is MMMCMXCIX, nine characters. 3888 is MMMDCCCLXXXVIII, fifteen characters, the longest canonical numeral below 4000, because every place uses its longest block (MMM, DCCC, LXXX, VIII). If you run both values through the converter, the Characters tile shows the difference.

Reading a numeral: summing is not checking

The usual way to read a numeral is to go from left to right, adding each symbol's value and subtracting it instead when a larger symbol follows. This gives a number for almost any string:

IC    → -1 + 100        = 99
VX    → -5 + 10         = 5
IIII  → 1 + 1 + 1 + 1   = 4
MMMM  → 1000 × 4        = 4000

A reader like this always returns a result, but it accepts input that the strict convention rejects. Project Euler problem 89 is built on this gap. It provides a file of numerals that are valid under its loose rules but not necessarily in minimal form, and asks how many characters are saved by rewriting them all in minimal form.

A strict reader checks the shape of the input first and adds up the values only after that. The converter uses this pattern, matched against the whole upper-cased input:

^M{0,3}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$

In plain words:

  • M{0,3}: zero to three thousands. This is the pattern's 3999 ceiling.
  • (CM|CD|D?C{0,3}): the hundreds place is 900, 400, or an optional 500 followed by up to three 100s.
  • (XC|XL|L?X{0,3}): the same structure for tens.
  • (IX|IV|V?I{0,3}): the same structure for units.
  • ^ and $: the pattern must cover the whole string, with nothing before or after it.

The pattern mirrors the decimal structure from the previous section, one group per place. Dive Into Python 3 builds this same pattern step by step and is the classic teaching version.

You can see the result in the converter. In the Roman → Number direction, lowercase "xiv" gives 14 because the input is upper-cased before the check. IIII, IC and MMMM fail the pattern, and the tool shows "Invalid input for the selected direction." The same message appears for any rejected input, whatever the reason.

This strictness is a deliberate choice of the modern form, not a claim that historical spellings were illegal. The converter is built to produce and check the one canonical form, so that every result maps back to a single number.

Ⅻ is not XII: Roman numerals as characters

Unicode has dedicated Roman numeral characters at U+2160–U+217F, such as Ⅳ and Ⅻ (Unicode Number Forms chart). The chart gives each one a compatibility decomposition to ordinary Latin letters, so NFKC normalization turns Ⅻ into the three letters XII. Before normalization, though, Ⅻ is a single code point that only looks like XII.

The converter accepts plain letters only. A numeral copied from a PDF or a styled web page may contain one of these characters, and the converter will reject it even though it looks right on screen. For a practical guide to this and other look-alike problems, see checking a date in Roman numerals before engraving.

Why the letters outlived the arithmetic

In Europe, Hindu-Arabic numerals replaced Roman numerals for calculation over roughly the 13th to 16th centuries (Britannica, Wikipedia).

The reason is easy to see on paper. With positional digits and a zero, you can write numbers in columns and add, subtract or multiply them one digit at a time, carrying as you go. Roman numerals have no columns, so the same written method does not work.

Roman numerals survived as labels rather than tools for calculating: regnal numbers, copyright years, outlines and list markers. MDN's list of list-style-type values is a reminder that browsers still render them every day.

Privacy

The conversion runs entirely in your browser. The value you type is not uploaded or stored, and the page carries the badge "Runs locally in your browser". The only place the result goes is your clipboard, when you choose Copy result.

FAQ

Did the Romans themselves write IV for four?

Sometimes, but not consistently. IIII and IV both appear, and neither was compulsory. The rule that four must be IV belongs to the modern strict form, not to Roman practice.

Is MIM ever acceptable for 1999?

A lenient left-to-right reader turns MIM into 1999, and it is shorter than MCMXCIX. Under the six-pair convention, though, I may be subtracted only from V and X, so the strict spelling is MCMXCIX and a strict checker, including this converter, rejects MIM. On a sign or a design the choice is a matter of style, but do not expect software to agree with the short form.

Why does a strict converter accept xiv but reject IIII?

Case does not change what a numeral means, so lowercase input is upper-cased before it is checked. IIII has a different shape: the canonical pattern allows at most three Is in a row, and four is written IV. The converter checks the canonical form, not every form that people can read.

Why does a numeral copied from a PDF fail when it looks right?

It probably contains one of the single-character Unicode numerals, such as Ⅻ, instead of separate letters. Retype it with ordinary letters and try again (in code, NFKC normalization converts those characters to plain letters).

Further reading