Most smoke alarms have a life span of 10 years but some have as little as 5 years. It should be replaced at its expiry date even if it appears to be working fine. Most manufacturers will have the expected life span labelled on the back of the alarm.
Remember! Smoke alarms need testing. A good time to remember to do this is in the spring and fall with the time change.