The rules
Roman numerals use seven letters: I = 1, V = 5, X = 10, L = 50, C = 100, D = 500 and M = 1,000. A number is written from the largest value down, and a smaller letter placed before a larger one is subtracted, which gives IV (4), IX (9), XL (40), XC (90), CD (400) and CM (900).
Each value has exactly one standard spelling, so the converter rejects forms such as IIII or MIM and shows the standard one instead.