The layout of a modern fretboard is based on two things. When a string is shortened by half the length, the pitch is raised by one octave. This octave is divided into twelve semitones in an equally tempered scale.
The offset for the first fret, from the nut or zero-fret, is calculated using the twelfth root of two (21/12, approximately 1.059463094, the number which multiplied with itself twelve times would equal two). The formula is:
offset = scale length – (scale length ÷ 21/12)
A fretboard needs more than one fret. If all frets are calculated from the result of calculating the previous fret, approximation errors may add up. This may not have any significance, there is also deviation when measuring and cutting the fretboard. To keep precision up, each fret should be calculated with offset from nut or zero-fret. The formula for each fret is:
offset = scale length – (scale length ÷ 2fret number/12)
The calculator at the left side of the page uses this formula. It works the same way for inches and millimeters.
In spreadsheets and scripts the notation will be something like this:
offset = scale length – (scale length / (2 ^ (fret number/12)))
The constant of 17.817 is often used. It’s derived from the first formula. Dividing the scale by 17.817 gives the offset for the first fret. Using this method has the same problem as using the first formula. The constants 18 and 17.835 have been used earlier and are not mathematically founded.
The world is not ideal. Strings need space to oscillate. That’s what produces the tone. The movement is widest halfway between the ends. That’s why the strings are lifted up from the fretboard by the bridge. A thicker string needs more space than a thin string. That’s why strings are lifted more on the bass side.
Strings are lifted from the fretboard by the bridge
When pushing the string toward the fretboard, the tension of the string is increased. The pitch is raised. As we go down the fretboard, the height of the string increases, raising the pitch more and more. As we go from thinner to thicker strings, the height gives more raise in pitch.
Now we have a problem. This is solved by offsetting the bridge, prolonging the scale.
Curved fretboards and fan-fretting introduces other problems not covered here.
Check out our extensive resource of Free Mandolin Tabs