One fraction, and then a rummage in a box
Screwcutting works because the carriage is driven by the leadscrew and the leadscrew is driven by the spindle. Whatever fraction of a spindle turn the leadscrew makes is multiplied by the leadscrew lead to give the advance of the tool per turn of the work, and that advance is the thread lead. So the gear ratio is the thread lead divided by the leadscrew lead, and nothing else in the machine changes it.
Cutting 20 TPI on an 8 TPI leadscrew wants a lead of 0.0500 in from a leadscrew that gives 0.1250, so the leadscrew must turn 0.4 of a spindle turn. Two fifths. A 20 tooth driver on a 50 tooth driven does it exactly, and so does 40 on 100.
Where 127 comes from
A metric pitch on an inch leadscrew puts 25.4 into the fraction, and 25.4 is exactly 127 divided by 5. A 1.5 mm pitch on an 8 TPI leadscrew needs a ratio of 0.4724409, which is 60 over 127 to the last decimal place a lathe will ever notice. There is no other tooth count that closes it: 127 is prime, so nothing smaller divides into it, and any train without it is an approximation.
How good an approximation is the question the table answers. On a 1 in thread the difference between exact and nearly exact is often a few tenths, which nothing will find. On a 6 in leadscrew it is a nut that gets tight at one end.
The drift column is the one to read
A ratio error of a few hundred parts per million sounds like nothing. Multiply it by the length of the thread and it becomes a distance, and a distance is something a thread gauge can find. The page works this out for whatever thread length you enter, and also prints how far the thread would have to run before it was half a pitch out — the point at which the thread it cuts and the thread it should have cut are in antiphase.
That is the honest way to think about a near miss. There is no threshold at which an approximate train becomes acceptable; there is a length of thread over which the error stays below whatever your part can tolerate, and only the print knows what that is.
Simple, compound, and the idler that does not count
A simple train is one driver on the spindle and one driven on the leadscrew, with an idler between them if the direction needs reversing or the centres need bridging. The idler is in the mesh but not in the ratio: it multiplies by its own tooth count and divides by it again. A compound train puts two gears on a common stud so that one pair drives the stud and the other pair drives on from it, and the two ratios multiply. That is what gets you ratios a single pair cannot reach with the gears in the box.
Searching both together with fourteen gears is 24,206 combinations, which is why this is a page rather than an afternoon. The table drops duplicates that give the identical ratio and lists whichever came up first, preferring the simple train when two are tied.
What the table cannot see
It has no idea whether the gears fit. A banjo swings through a limited arc, gear centres have to line up with the mesh, and a 100 tooth gear next to a 20 tooth one on a small lathe may simply not go on. Every list of ratios produced this way needs checking against the physical machine, and the trains that rank best are quite often the awkward ones.
It also assumes one of each gear. Most boxes are like that, but not all — a spare 40 or a second 50 changes what is reachable, and if you have them the honest thing is to add them to the list and let the search use them. Conversely, a gear that is keyed to one position only should come out of the list, because a ratio that depends on it is not really available.
Questions people ask
How do I work out change gears for a thread?
Divide the lead of the thread you want by the lead of the leadscrew. That fraction is how much the leadscrew must turn for one turn of the spindle, and the gear train has to produce it. Cutting 20 TPI on an 8 TPI leadscrew needs 0.0500 divided by 0.1250, which is 0.4, and a 20 tooth driver on a 50 tooth driven gives it exactly.
Why does a metric thread on an inch lathe need a 127 tooth gear?
Because the conversion between the two systems is 25.4 millimetres to the inch, and 25.4 is exactly 127 over 5. A 127 tooth gear is the only tooth count that puts that factor into a gear train exactly, and 127 is prime so nothing smaller substitutes for it. Every train without one is an approximation, and how much of an approximation depends on how long the thread is.
Does the idler gear change the ratio?
No. An idler multiplies the ratio by its own tooth count and then divides by it again, so it cancels. It is there to reverse the direction of the leadscrew or to bridge a gap between centres that the driver and driven gears cannot reach across. That is why it does not need to be in the gear list on this page.
How close is close enough for a change gear train?
That depends on the thread length and what the part has to fit, and this page will not decide it. What it gives you instead is the drift: how far the last thread has walked from where it should be over the length you are cutting, and how long the thread would have to run before it was half a pitch out. Compare those against the print rather than against a rule of thumb.
Will the gears the calculator picks actually fit my lathe?
It has no way to know. The search only checks tooth counts against a ratio; it does not know your banjo arc, your stud positions or how much room there is before a gear fouls the casting. A large gear next to a small one is the usual problem. Work down the ranked list until you reach a train that physically mounts, and check the mesh with the gears in your hand before cutting.