Cable size calculator
This sizes for voltage drop only. A real cable selection also has to satisfy current-carrying capacity after derating for grouping, insulation, ambient temperature and installation method, plus disconnection times for fault protection.
The minimum conductor area for a voltage-drop limit is 2 × ρ × L × I ÷ (limit × V). Twenty amps over 40 m at 230 V within 3% needs 3.99 mm², so the next standard size up is 4 mm² — which then drops 2.99%.
How to size a cable
Cable selection is two separate tests and the bigger answer wins. The first is current-carrying capacity: can the cable carry the load without its insulation exceeding its rated temperature, after derating for how it is installed, how many cables share the route, and how hot the surroundings get. The second is voltage drop, which is what this page computes. On short runs the current test almost always dominates; past twenty or thirty metres, voltage drop takes over and starts driving the size up quickly, because drop is linear in length.
Questions
Take the larger of two answers: the size that carries the current after derating, and the size that keeps voltage drop inside the limit. This page answers the second.