Here is the formula from ABYC E-11:
220.127.116.11.1 To use TABLE IX and TABLE X , measure the length of the conductor from the positive power source connection to the electrical
device and back to the negative power source connection. Use the conductor length, the system voltage, and the ampacity as specified in E-18.104.22.168, in conjunction with
the appropriate volt drop table, i.e., three percent or 10 percent – TABLE IX or TABLE X, to determine conductor size.
1. The power source connection may be the battery, or a panelboard or switchboard, if used.
2. If the ampacity as specified in E- 22.214.171.124 exceeds the ampacities in TABLE IX and TABLE X, the conductor size necessary to keep voltage drop below the maximum permitted level may be calculated by means of the following formula:
CM = (K x I x L)/E
CM = Circular mil area of conductor.
K = 10.75 (constant representing the resistivity of copper)
I = Load current
L = Length of conductor from the positive power source connection to the electrical
device and back to the negative power source connection, measured in feet.
E = Maximum allowable voltage drop at load in volts (e.g., for a three percent voltage drop at nominal 12V, E= 0.03 x 12 = 0.36; for a 10 percent voltage drop at nominal 12V, E = 1.2).
3. Use TABLE XI or TABLE XII to convert circular mils (cm) to conductor gauge. If the cm area falls between two gauge sizes, the larger conductor shall be used.
This is the formula that all of the wire sizer programs are based on.