Port length is related to the desired tuning of the port. Tuning is a function of port opening area, port length and the volume of the enclosure after displacements have been subtracted.
Tune frequency is determined by you because it has to do with your listening preferences and how you want it to perform.
There are calculators online, some are accurate, some are not. Do not use the calc from RE Audio, there is very incorrect.