Most mattresses are built to perform well for around 7-10 years, but how you sleep on it, your body weight, and how well it is cared for can shorten or extend that window considerably.
The clearest sign it is time for a replacement is visible sagging — a dip in the middle or under where you usually lie that does not spring back. Waking up with new aches, noticing you sleep better away from home, or hearing creaking springs are all signals worth paying attention to as well.
Simple habits extend a mattress's life: rotating it every few months, using a breathable protector, and giving it proper support with a solid base or slats rather than a broken or sagging frame.
If your mattress is out of warranty and showing several of these signs, it is usually more cost-effective in the long run to replace it than to keep sleeping on worn-out support — poor sleep quality affects far more than just your back.