What length extension cord should I buy?

What length extension cord should I buy?

The shortest one that reaches.

Longer cords mean more resistance and voltage drop. For a lamp three feet from the outlet, a six-foot cord is fine. For a lawnmower at the far end of the yard, you need a heavy-duty 100-footer. Buy for the job, not for flexibility.