This page explains how Roman numerals work. This is the convention I was taught in school. The Romans (and subsequent users) weren't nearly as strict about how to write numbers in their day, but this is the way you will see Roman numerals written in almost all cases today.
First, here is the value of each letter:
I = 1 (one) V = 5 (five) X = 10 (ten) L = 50 (fifty) C = 100 (one hundred) D = 500 (five hundred) M = 1000 (one thousand)
Note that there was no number smaller than one. The concept of zero and negative numbers did not exist.
There are actually values over 1000 (M). Putting a bar over the appropriate letter indicates it should be multiplied by 1000. So, for example, "V" with a bar over it would be 5000. This gives letters up to M-bar or 1,000,000 (one million). Unfortunately, barred letters are hard to write in HTML, so we'll stick with non-barred letters. (By the way, "I" was never barred since I-bar equals "M.")
Think of each combination of letters of equal powers of ten as one digit. For example, in CCCLXII (362), CCC (300) is the hundreds, LX (60) is the tens, and II (2) is the ones.
Subtraction only takes place for four and nine times a power of ten (i.e. 4, 40, 400, 9, 90, 900). This is to avoid more than three of the same letter in a row. It is written by putting a smaller value in front of a larger one. So 4 is IV, not IIII. And 900 is CM, not DCCCC.
This complicates the first statement of this section some because there might be a higher power of ten in a lower power of tens section. For example, in MCMIX (1909), M (1000) is the thousands, CM (1000 - 100 = 900) is the hundreds, and IX (10 - 1 = 9) is the ones.
To put it most concisely: When converting to Roman numerals, convert each digit separately. For example, for 953 convert 900, 50, and 3 to give CM, L, and III to get CMLIII.
For more information on how Roman numerals work, please check the sites in the Links section.