Change it when it's 2% longer than it was new. Assuming a 5/8" pitch chain (#520, 528, 530, 50, etc.), the length of ten full links pin to pin should be 6.25", 20 links, 12.5". Two percent over each of these would be 6.375" (6 3/8") and 12.75" (12 3/4"). The chain must be drawn taught when measuring, which is easily accomplished by placing a piece of wood or a tool handle between the chain and sprocket and rolling it under the chain to tighten it.
Another very accurate means of measuring the chain is to use a typical 6-7" vernier caliper on a 10 link section as shown in the attachment. Measure from one roller surface to the 11th one, and measure several sections. Compensating for the .400" roller diameter, the new length of the chain measured this way is 5.85", and 2% over is 6.0".
Once the chain is that much longer than spec, it starts chewing on the teeth of the sprockets. New sprockets can be installed without replacing the chain so long as it is 1% or less longer than new without any kind of problem.