Metric Thread ISO Minimum Thread Engagement Calculator
For equations and illustrative graphics see:
Minimum Thread Engagement Formula and Calculation ISO
The screw should fail before the thread strips. For this, it is necessary the shear area of the threaded feature be at least 2 times the tensile area. (Assuming the threaded feature is of the identical material).
All units shall be consistant and given in inches.