Convert between Arabic and Roman Numerals

Navigation

Skip navigation.

Site search

Site navigation

How it works

To convert between Arabic and Roman numerals, use the following translation table.

Roman Arabic
M 1000000
D 500000
C 100000
L 50000
X 10000
V 5000
M 1000
D 500
C 100
L 50
X 10
V 5
I 1

Smaller numbers before larger numbers are subtracted from the larger number. Smaller numbers after larger numbers are added to the larger number.

Take each number in turn. Convert it into its Roman equivalent. In this example, P is a multiple of 10 and Q is a multiple of 5, half the value of P. R is a multiple of 10, one tenth the value of P. 'x' is used here to represent a possible multiple of ten. Note, there is no zero value.

Arabic Roman equivalent
1x R
2x RR
3x RRR
4x RQ
5x Q
6x QR
7x QRR
8x QRRR
9x RP
10x P

The patterns 45, 49, 95, 99..95, 99 and 99..9 can all be optimised to just two numerals, although traditionally, this would not be used. Traditionally, IIII was sometimes used in place of IV (to avoid confusion with the shortened form of the name IVPPITER [Jupiter]). This script will only output the normal IV variant, though it will accept both forms as input.

Sample output

Days since 01/01/1970 (UNIX epoch):

XXII

Time on the server (in seconds):

XXMDXLIV

Try it

For Roman to Arabic conversion, use _M to replace M etc.

To download the script(s), and see the script license, use the links on the navigation panel at the top of this page.

How does the conversion work?

(Note: this page shares the strict doctype used by most pages on this site, but the underline element used by this script requires a transitional doctype, so yes, this page will not validate. If you want your page to validate, make sure you use a transitional doctype when using this script.)

This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.