Sonic's official in-game age is 15, and that has stayed consistent across the games, cartoons and films.
Any other figure you see quoted is usually someone counting from the character's 1991 debut rather than his age within the story, which is a different question entirely.