Roman numerals are a numerical system that originated in ancient Rome. They are used to represent numbers in the decimal system, but they are not used for mathematical operations.

In this system, symbols are used to represent different numbers, with I representing 1, V representing 5, X representing 10, L representing 50, C representing 100, D representing 500, and M representing 1,000.

Here is a table of the symbols used in the Roman numeral system:

1 5 10 50 100 500 1,000
I V X L C D M

The value of a numeral is determined by its position in relation to other symbols. When a symbol of equal or lesser value is placed after another symbol, their values are added. But when certain symbols of lesser value are placed before another symbol, their values are subtracted.

For example, the numeral VI, or 6, would be read as "five plus one" (5 + 1), and XI, or 11, is "ten plus one" (10 + 1).

But the methods for representing 4 and 9 are special. The Roman numeral IV, or 4, would be read as "one less than 5" (5 - 1). Also, the numeral IX, or 9, would be read as "one less than 10" (10 - 1).

Here is a table of numbers and their Roman numeral equivalent, followed by more in-depth explanations about how to perform the conversions. Just scroll through the table or use Ctrl/Cmd + f to find the value you're looking for:

NumberRoman numeral
1I
2II
3III
4IV
5V
6VI
7VII
8VIII
9IX
10X
11XI
12XII
13XIII
14XIV
15XV
16XVI
17XVII
18XVIII
19XIX
20XX
21XXI
22XXII
23XXIII
24XXIV
25XXV
30XXX
40XL
50L
60LX
70LXX
80LXXX
90XC
100C
101CI
102CII
103CIII
104CIV
105CV
200CC
300CCC
400CD
500D
600DC
700DCC
800DCCC
900CM
1,000M
1,001MI
1,002MII
1,003MIII
1,004MIV
1,005MV
1,900MCM
2,000MM
3,000MMM
3,999MMMCMXCIX

How to Convert a Number into Roman Numerals

Because Roman numerals are often ordered from largest to smallest, break the number you're converting up into groups of thousands, hundreds, tens, and ones, and perform the conversion on each group.

For example, if you want to convert the number 2,014 (the year freeCodeCamp was founded) into Roman numerals, break the number up as follows:

2,014 = 2,000 + 10 + 4

Then perform the conversion on each group and combine them to get the Roman numeral equivalent:

* 2,000 = MM
* 10 = X
* 4 = IV

2,014 = 2,000 + 10 + 4 = MMXIV

How to Represent Large Numbers in Roman Numerals

You might have noticed that the chart above only goes from 1 to 3,999.

This is due to the special methods for representing 4 and 9 mentioned above. If you check the table above, you'll see that whenever a 4 or 9 appears (including 40, 90, 400, 900) that the Roman numerals are ordered in a particular way so the lesser symbol is subtracted from the one of greater value immediate afterwards.

Since Roman numerals were never fully standardized, you might see the number 4,000 represented as MMMM.

This works, but many see this as invalid since 4 (and 9) have special representations in lower numbers.

Instead, one of the most common ways to represent larger Roman numerals is with a vinculum, or a straight horizontal line above one or more symbols.

If you see a Roman numeral symbol with a horizontal line over it, that just means to multiply that symbol by 1,000.

Here are the Roman numeral symbols with the vinculum applied:

1,000 5,000 10,000 50,000 100,000 500,000 1,000,000
M or I V X L C D M

With this extended set of Roman numeral symbols, 4,000 would be represented as the following:

IV

And here's a table of larger numbers and their Roman numeral representations to get you started:

Number Roman numeral
4,000 IV
4,001 IVI
4,002 IVII
4,003 IVIII
5,000 V
6,000 VI
7,000 VII
8,000 VIII
9,000 IX
10,000 X
40,000 XL
90,000 XC
400,000 CD
900,000 CM
1,000,000 M

How to Add a Vinculum or Horizontal Line Over Roman Numerals With HTML and CSS

For you devs out there, the easiest way to add a vinculum to Roman numerals online is to wrap the symbols in an element and use a bit of CSS.

For example, to add a horizontal line over the symbols IV in IVIII, you can wrap them in a span element and set its text-decoration property to overline:

<p><span style="text-decoration: overline;">IV</span>III</p>

Which will render the following:

IVIII

Thanks for Reading

If you found this breakdown of Roman numerals helpful, please share it with your friends so more people can benefit from it.

Also, feel free to reach out on Twitter and let me know what you think.