Skip to content
AgileLogics

Roman Numeral Converter

Converts a whole number (1-3999) to its Roman numeral, or decodes a standard-form Roman numeral back to a number.

How it works

Enter a number or Roman numeral, choose a direction, and click Convert.

How do Roman numerals work?

Roman numerals write numbers with seven letters, each worth a fixed value: I is 1, V is 5, X is 10, L is 50, C is 100, D is 500 and M is 1000. You add the values from left to right, except where a smaller letter comes before a larger one, which means subtract it. So VI is 6, IV is 4, and MMXXVI is 2026.

This converter goes both ways. Number → Roman takes a whole number from 1 to 3999; Roman → Number reads a numeral in upper or lower case.

The seven symbols and six subtractive pairs

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

In the standard form, those six pairs are the only subtractions allowed. Only I, X and C go in front of a larger symbol, and only of the next two symbols up: I before V or X, X before L or C, C before D or M. So 99 is XCIX (90 + 9), not IC, and 999 is CMXCIX, not IM.

Converting a number to Roman numerals

The converter uses the method you'd use on paper, working from the largest value down:

  1. Start with the number, say 1994.
  2. Find the largest value in the table (including the pairs) that fits. 1000 fits, so write M and subtract, leaving 994.
  3. Repeat. 900 fits, so write CM, leaving 94.
  4. 90 fits: XC, leaving 4.
  5. 4 fits: IV, leaving 0.

Join the pieces and 1994 is MCMXCIV. A few more:

Number Roman Breakdown
444 CDXLIV 400 + 40 + 4
888 DCCCLXXXVIII 500 + 300 + 50 + 30 + 5 + 3
1987 MCMLXXXVII 1000 + 900 + 50 + 30 + 5 + 2
3999 MMMCMXCIX 3000 + 900 + 90 + 9

Notice that length has nothing to do with size. 888 needs twelve letters, while 1000 needs one.

Input rules for numbers

Number → Roman accepts plain digits only, from 1 to 3999, with optional spaces around them. Everything else gives "Enter a whole number between 1 and 3999.":

  • 0, negative numbers and 4000 or more
  • decimals like 12.5
  • thousands separators like 1,000
  • a plus sign or leading zeros, such as +5 or 007

Reading Roman numerals, and the validity check

Roman → Number scans the letters left to right. If a letter is worth less than the one after it, its value is subtracted; otherwise it's added. MCMXCIV becomes 1000 − 100 + 1000 − 10 + 100 − 1 + 5 = 1994.

That rule on its own would produce a number for any arrangement of the seven letters, valid or not. So before showing a result, the converter writes the value back out as a Roman numeral and checks that it matches your input letter for letter. If it doesn't, your numeral isn't in standard form and you get an error instead of a misleading number:

Input Result Standard form
IIII Error IV for 4
IC Error XCIX for 99
VV Error X for 10
IIX Error VIII for 8
MCMXCIVX Error MCMXCIV for 1994
MMMM Error: "Standard Roman numerals only go up to 3999 (MMMCMXCIX)." (none, out of range)

The error for a nonstandard numeral reminds you of the rules: subtract only with the pairs IV, IX, XL, XC, CD and CM, never repeat V, L or D, and don't repeat I, X, C or M more than three times in a row. If you're not sure of the right spelling, switch to Number → Roman and convert the value you meant.

Some nonstandard forms have real uses. IIII appears on many clock faces, and older inscriptions aren't always consistent. This converter sticks to the modern standard, which is what you want when checking a numeral for a tattoo, an engraving or a cornerstone date: if Roman → Number gives you a number, the numeral is written correctly.

Characters other than the seven letters are rejected with "Enter a valid Roman numeral, e.g. XIV.", including spaces between letters (X I V). The single-character forms in Unicode's Number Forms block, such as Ⅻ, are rejected too, so type ordinary letters.

Related tools

Roman numerals are one of several ways to write the same number. For numbers written out in English, use number to words, and for the positional systems computers use, try decimal to binary or decimal to hex. Writing your own Roman numeral converter is a classic exercise when you learn Python, and the greedy method above translates almost line for line into code.

Last updated

Frequently asked questions

How do you write 2026 in Roman numerals?
MMXXVI. Break the number into 2000 + 20 + 6, then write MM for 2000, XX for 20 and VI for 6.
Why can't I convert numbers above 3999?
Standard Roman numerals have no symbol larger than M (1000), and a symbol isn't repeated more than three times in a row, so MMMCMXCIX (3999) is the largest number they can write. Historical notations for bigger numbers, such as a bar over a numeral to multiply it by 1000, aren't supported. Zero and negative numbers have no Roman form at all.
Does the converter check that a Roman numeral is written correctly?
Yes. Roman to Number only accepts numerals in standard form. Nonstandard spellings such as IIII, IC or VV get an error explaining the rules instead of a number, and MMMM is rejected because it is above 3999. If you get the error, convert the number you meant with Number to Roman to see the standard spelling.
Can I type lowercase numerals?
Yes. mmxxvi and MMXXVI both give 2026. Spaces before or after are ignored, but spaces between the letters are not allowed.
Is anything sent to a server?
No. Both directions run in your browser.