Put a bit of tension on the chain and a 12" ruler against it. If 12 pairs of links are more than 1/16" over 12", the chain needs replacement. If it's more than 1/8" over, it chews cogs pretty hard.
But even if it's only a little worn it'll accelerate wear on the cassette. You can get more life out of a cassette by getting two or three chains at the same time as the cassette and rotating them every 1000km or so.