Here's how we know:
* Snape's Birth Year: Snape was born in 1960 (mentioned in the books).
* Harry's Birth Year: Harry was born on July 31, 1980.
* Sorcerer's Stone Setting: The events of the first book take place in 1991, when Harry is 11 years old.
* Snape's Age: Therefore, Snape would have been 31 years old in 1991 (1991 - 1960 = 31).