Roman Numerals to Numbers Converter Online Tool

Roman Numeral

Number

About Roman Numerals to Numbers Converter Online Tool:

This online Roman Numerals to Numbers Converter helps you to convert one Roman Numeral into a number (base 10). Put Roman Numeral into the first textbox, the number result will show in the second textbox.

Roman Numerals:

Roman numerals is invented by ancient Rome, it use letters from Latin ("I" for "1", "V" for "5", "X" for "10", "L" for "50", "C" for "100", "D" for "500", "M" for "1000") to represent numbers. Roman numerals is still widely used in academic paper chapter numbering system.

comic roman numerals to numbers

How to convert from Roman Numeral to Number?

  1. Step 1: Remember the Latin letters list ('I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000). Remember its order and each value.

  2. Step 2: From left to right, subtract a letter's corresponding value if it appears before a larger letter.

    Example 2.1: IV = V − I = 5 − 1 = 4

    Example 2.2: XL = X − L = 50 − 10 = 40

  3. Step 3: In other case, add a letter's corresponding value.

    Example 3.1: XXXV = X + X + X + V = 10 + 10 + 10 + 5 = 35

    Example 3.2: CXXIII = C + X + X + I + I + I = 100 + 10 + 10 + 1 + 1 + 1 = 123

Example 1: Convert Roman Numeral "CXLVI" to Number:

CXLVI = C + XL + V + I = 100 + (500-10) + 5 + 1 = 146

Example 2: Convert Roman Numeral "CDXCIV" to Number:

CDXCIV = CD + XC + IV = (500-100) + (100-10) + (5-1) = 494

Roman Numerals to Numbers conversion table:

Roman Numerals Numbers Roman Numerals Numbers
I 1 XXI 21
II 2 XXII 22
III 3 XXIII 23
IV 4 XXIV 24
V 5 XXV 25
VI 6 XXVI 26
VII 7 XXVII 27
VIII 8 XXVIII 28
IX 9 XXIX 29
X 10 XXX 30
XI 11 XXXI 31
XII 12 XXXII 32
XIII 13 XXXIII 33
XIV 14 XXXIV 34
XV 15 XXXV 35
XVI 16 XXXVI 36
XVII 17 XXXVII 37
XVIII 18 XXXVIII 38
XIX 19 XXXIX 39
XX 20 XL 40

More information:

Wikipedia (Roman numerals): https://en.wikipedia.org/wiki/Roman_numerals

Convert Roman Numerals to Numbers with Python:

def transform_roman_numeral_to_number(roman_numeral):
    roman_char_dict = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
    res = 0
    for i in range(0, len(roman_numeral)):
        if i == 0 or roman_char_dict[roman_numeral[i]] <= roman_char_dict[roman_numeral[i - 1]]:
            res += roman_char_dict[roman_numeral[i]]
        else:
            res += roman_char_dict[roman_numeral[i]] - 2 * roman_char_dict[roman_numeral[i - 1]]
    return res


roman_numeral_input = 'MMXVIII'
number_output = transform_roman_numeral_to_number(roman_numeral_input)
print('Roman numeral {0} equal to:{1}'.format(roman_numeral_input, number_output))

-------------------
Roman numeral MMXVIII equal to:2018

Convert Roman Numerals to Numbers with Java:

import java.util.Map;
import java.util.HashMap;

public class NumberConvertManager {
    public static int transform_roman_numeral_to_number(String roman_numeral) {
        Map<Character, Integer> roman_char_dict = new HashMap<Character, Integer>();
        roman_char_dict.put('I', 1);
        roman_char_dict.put('V', 5);
        roman_char_dict.put('X', 10);
        roman_char_dict.put('L', 50);
        roman_char_dict.put('C', 100);
        roman_char_dict.put('D', 500);
        roman_char_dict.put('M', 1000);
        int res = 0;
        for (int i = 0; i < roman_numeral.length(); i += 1) {
            if (i == 0 || roman_char_dict.get(roman_numeral.charAt(i)) <= roman_char_dict.get(roman_numeral.charAt(i - 1)))
                res += roman_char_dict.get(roman_numeral.charAt(i));
            else
                res += roman_char_dict.get(roman_numeral.charAt(i)) - 2 * roman_char_dict.get(roman_numeral.charAt(i - 1));
        }
        return res;
    }

    public static void main(String[] args) {
        String roman_numeral_input = "MMXVIII";
        int number_output = transform_roman_numeral_to_number(roman_numeral_input);
        System.out.println("Roman numeral " + roman_numeral_input + " equal to:" + number_output);
    }
}

-------------------
Roman numeral MMXVIII equal to:2018