Every gas appliance has a BTU input, every run has friction, and the pipe is the only thing in between. Over-size and you waste steel; under-size and the appliance starves at the far end.
Gas Pipe Sizing Calculator uses the longest-run method with a standard natural gas capacity table to pick the pipe size.