Roman Numeral Converter

Ancient math in your browser. This tool provides bidirectional conversion between Arabic integers (1, 2, 3) and Roman numerals (I, II, III).

Copy the Script

<script>
function convertToRoman(num) {
    var lookup = {M:1000,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1};
    var roman = '';
    for (var i in lookup ) {
        while ( num >= lookup[i] ) {
            roman += i;
            num -= lookup[i];
        }
    }
    return roman;
}
</script>

Frequently Asked Questions

Standard Roman numerals stop around 3,999 (MMMCMXCIX). Above that, they require a vinculum (overline) which is hard to type, so most scripts cap at 3,999 or 4,999.

The Romans did not have a numeral for zero. This script usually returns an empty string or 'nulla' if 0 is entered.

Yes. The script can parse a Roman string back into an integer by iterating through the characters and checking if the next character is larger (subtraction rule).