You can do it the hard way by actually doing the calculations on paper, but it is much easier to use a program like Unibox, WinISD, or whatever box building program you want to use.
Couple of rules of thumb to get an idea.
A bigger box requires shorter ports to get the same tuning freq and conversely, a smaller box will require longer ports. So, a 5 cu ft box may need a 16" long port for a given port area (area of the mouth of the port), while a 2 cu ft box might require 48" long ports.
The larger the opening (port area), the longer the port will be.
Smaller port areas require less length but increase port noise.
Round ports are always superior to slot ports with regards to performance. Whether the difference is audible or not is certainly debatable and I would suspect that it wouldn't be in most cases.
Flaring the ends of the ports can reduce port "chuffing"
Slot ports are tremendously easier to use in most car audio installs, as round ports are difficult to implement. Slot ports can be bent.
When using a slot port, try to keep the ratio of height to width as small as possible. a 24" x .5" port is not as good as 12x1 and much much worse than 4x3.