What a rafter calculator is solving
A common rafter follows the diagonal line from the top plate to the ridge. If you know the roof span and the pitch, the roof geometry becomes a right-triangle problem: half the span gives the horizontal run to the ridge, the pitch gives the rise over that run, and the rafter length follows from the hypotenuse.
That makes a rafter length calculator useful for sheds, garages, porches, and simple gable roofs. It helps you compare whether the roof pitch and overhang you want still fit the stock lengths you plan to buy before you move on to birdsmouth detail, ridge thickness, and connector layout.