☖ Home Units Converter Geometry Σ Math Physics Electricity

Roman numbers calculator

Print Roman numbers calculator
Decimal Number
Roman Numeral
Notes:
Roman Numerals (up to 3,999)
Extended Roman Numerals (up to 3 999 999)

1

5

10

50

100

500

1 000

1 000

5 000

10 000

50 000

100 000

500 000

1 000 000
Practice Roman and Decimal Numerals
Detail solution
Table of roman numbers from decimal:    Size:

Roman numerals summary

Print Roman numerals
     The numeral system known as Roman numerals originated from the system used by the Etruscans, a sophisticated pre-Roman civilization in central Italy. The Romans adopted and developed this system to measure lengths and quantities. Roman numerals remained widely used throughout Europe until the late Middle Ages, particularly during the 14th and 15th centuries.

     Roman numerals are represented by seven Latin letters: I, V, X, L, C, D, and M. Each symbol has a fixed value. The values of numerals are determined according to the following rules:

  • If a symbol of lower value appears to the left of a symbol of higher value, its value is subtracted. Only one such subtraction is allowed. For example, IV = 5 − 1 = 4.
  • If a symbol is followed by one of equal or lower value, its value is added. For example, VI = 5 + 1 = 6.
    The correct order of significant digit inputs is:
    M  →  D  →  C  →  L  →  X  →  V  →  I.
  • Only symbols representing powers of ten (I, X, C, and M) may be repeated, and only when placed to the right of a symbol with equal or greater value. No symbol may be repeated more than three times in succession. Examples include III, XXX, CCC, and MMM.
  • Roman numerals can be extended by a factor of 1,000 by placing a bar (or line) over a numeral, which multiplies its value by 1,000. In this calculator, we represent these extended numerals using lowercase letters (see Table 1).
Clock
A clock with roman numerals
at the enterance to the
Venetian Arsenal.

Table − 1   Roman Numeral Values

Standard numbers values Extended values
Maximum number up to 4,999 Maximum number up to 4,999,999
RomanDecimalRomanDecimal
I1
V5V     v5000
X10X     x10000
L50L     l50000
C100C     c100000
D500D     d500000
M1000M     m1000000

Table − 2   Roman Numeral Combinations of Lower Values

SymbolValueCalculation
IV45 − 1
IX910 − 1
XL4050 − 10
XC90100 − 10
CD400500 − 100
CM9001000 − 100
Mv40005000 − 1000
Mx900010000 − 1000
xl4000050000 − 10000
xc90000100000 − 10000
cd400000500000 − 100000
cm9000001000000 − 100000

In some cases, the Romans used four consecutive identical symbols instead of subtractive notation, such as IIII instead of IV, XXXX instead of XL, or CCCC instead of CD.

roman numbers calculation jscript code

Print Roman numerals jscript code
JavaScript code to convert decimal to roman and roman to decimal numbers
// Use this values for the regular roman numbers up to 3,999 //
var decimals = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];
var roman = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V",
"IV", "I"];
// Use this values for the extended roman numbers up to 3,999,999 //
var decimals = [1000000, 900000, 500000, 400000, 100000, 90000, 50000,
40000, 10000, 9000, 5000, 4000, 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];
var roman = ["m", "cm", "d", "cd", "c", "xc", "l", "xl", "x", "ix", "v",
"iv", "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"];
function decimal2Roman(D) {
var R = '';
for (var i = 0; i < decimals.length; i++) {
while (D >= decimals[i]) {
R += roman[i];
D -= decimals[i];
}
}
return R;
}
function Roman2Decimal(R) {
var D = 0;
for (var i = 0; i <= decimals.length; i++) {
while (R.indexOf(roman[i]) == 0) {
D += decimals[i];
R = R.replace(roman[i], '');
}
}
return D;
}
JavaScript code for validating Roman numerals (both standard and extended formats).
The function returns true for valid input and false otherwise.
function isRomanValid(RomanNumber) {
// Standard Roman numeral using uppercase letters
const digits = '(V?[I]{0,3}|I[VX])';
const tens = '(L?[X]{0,3}|X[LC])';
const hundreds = '(D?[C]{0,3}|C[DM])';
const thousands = 'M{0,3}';
const regularPart = thousands + hundreds + tens + digits;
 
// Extended (×1000) part using lowercase letters
const digitsExt = '(v?[i]{0,3}|i[vx])';
const tensExt = '(l?[x]{0,3}|x[lc])';
const hundredsExt = '(d?[c]{0,3}|c[dm])';
const thousandsExt = 'm{0,3}';
const extendedPart = thousandsExt + hundredsExt + tensExt + digitsExt;
 
const regexPattern = new RegExp(
'^(' + extendedPart + ')?' + regularPart + '$'
);
 
return regexPattern.test(RomanNumber);
}