A CAS Registry Number (CAS RN) is a unique numeric identifier assigned by the Chemical Abstracts Service to a chemical substance. Unlike a trivial name, it does not change when people use a different synonym, which makes it the most practical key for matching substances across safety data sheets (SDS), supplier catalogues and datasets.
Format
A CAS number has three parts separated by hyphens: XXXXXXX-YY-Z.
- the first part has 2 to 7 digits,
- the second part has exactly 2 digits,
- the last part is a single check digit.
Examples:
| Substance | CAS RN |
|---|---|
| Water | 7732-18-5 |
| Ethanol | 64-17-5 |
| Caffeine | 58-08-2 |
| Acetylsalicylic acid (aspirin) | 50-78-2 |
The check digit
The last digit is computed from the others. Take all digits except the check digit, read them from right to left, multiply the first by 1, the second by 2, the third by 3 and so on, sum the products and take the result modulo 10.
For ethanol (64-17-5): the digits without the check digit are 6, 4, 1, 7. Read from the right they are 7, 1, 4, 6, so 7*1 + 1*2 + 4*3 + 6*4 = 45, and 45 mod 10 = 5. That matches the final digit.
Validation in Python
import re def is_valid_cas(cas: str) -> bool: if not re.fullmatch(r"\d{2,7}-\d{2}-\d", cas): return False digits = cas.replace("-", "") body, check = digits[:-1], int(digits[-1]) total = sum(int(d) * i for i, d in enumerate(reversed(body), start=1)) return total % 10 == check for cas in ["7732-18-5", "64-17-5", "58-08-2", "50-78-2", "64-17-4"]: print(cas, is_valid_cas(cas)) The last value, 64-17-4, fails because its check digit is wrong, which is a typical typo caught by this test.
Caveats
- A valid check digit only proves the number is well formed, not that it is assigned to the substance you think it is. Always confirm the substance name against a trusted source.
- One substance can have several CAS numbers (for example for different salts, hydrates or isomers), and mixtures may not have a single number.
Where to look up substances
For a quick lookup of a substance by name or CAS number, together with basic safety information, you can use the MolGod chemical substance reference. For hazard classification and handling, always read the official safety data sheet from the supplier of the exact product you use.
If you work with chemical data in code, validating CAS numbers at the input stage saves a surprising amount of cleaning later.

