Roman numeral converter — both directions
This tool converts any whole number from 1 to 3999 into a Roman numeral, and decodes a Roman numeral back into a number. It is handy for writing years on documents, reading clock faces and monument inscriptions, numbering book chapters or appendices, and checking homework. Decoding uses strict validation, so it tells you when a sequence is not a legal numeral.
How it works
To encode, the tool walks a fixed table from the largest value down — 1000 (M), 900
(CM), 500 (D), 400 (CD), 100 (C), 90 (XC), 50 (L), 40 (XL), 10 (X), 9 (IX), 5 (V), 4
(IV), 1 (I) — appending each symbol while it still fits and subtracting its value.
This is why 1994 becomes MCMXCIV, not MIM. To decode, it adds each symbol’s value
but subtracts when a smaller symbol precedes a larger one (IV = 5 − 1). It then
re-encodes the result and rejects the input if the two do not match, catching
malformed strings like IIII or VX.
Example
Enter 2026 → MMXXVI. Decode MCMXCIV → 1994. Try IIII and it is flagged
as invalid because the correct form is IV.
| Number | Roman |
|---|---|
| 4 | IV |
| 9 | IX |
| 40 | XL |
| 90 | XC |
| 2026 | MMXXVI |
| 3999 | MMMCMXCIX |
Both directions run entirely in your browser — nothing is uploaded.