Jan 012014

For the impatient: Just head over to the Online Involute Spur Gear Builder page.

Still here and interested in some background? Perfect! Involute gears are by far the most commonly used gears today. An involute curve is fairly easy to calculate and quite a number of freely available tools and scripts exist that use this fact to create involute gear profiles (see e.g., Gear template generator, Parametric Involute Bevel and Spur Gears, OpenJsCad’s gear demo, and many more). However, I have not found a freely available tool that correctly caters for undercuts that occur for smaller tooth counts (around 10 or less):


If the undercuts are ignored the resulting gears will jam if machined and assembled precisely. For an elegant description of the issue including a recipe for how to graphically create correct spur gears see Michal Zalewski’s corresponding section in part six of his excellent Guerrilla guide to CNC machining, mold making, and resin casting series.

The code behind the online involute spur gear builder determines the tooth profile by simulating how a gear with infinite radius (aka rack) would cut into a smaller gear as discussed by Michal Zalewki. The advantage of the infinite gear is that it has a very simple trapezoidal tooth form solely defined by the addendum height and the pressure angle. In the figure below the rack is shown at the top. When the rack is moved to the right the gear needs to rotate clockwise so that a point on the pitch circle of the gear moves with the same speed as the rack. The code simulates this movement in steps and then for each step subtracts the shape of the rack from the gear.


For illustration purposes the figure below has been calculated based on very coarse steps and only shows two teeth of the rack.


In reality the code simulates only one rack tooth and calculates the tooth profile of half a tooth of the matching gear. The complete gear is then assembled by mirroring and rotating the half tooth. All of this is accomplished by leveraging the ‘Constructive Area Construction’ capabilities of the csg.js library which is part of OpenJsCad. Each rack tooth location is calculated and created as a polygon. These polygons are joined together with the union operator to form one complex 2d shape that is then subtracted from a slice of the outer circle of the target gear to form half a tooth. Finally, the complete gear is assembled from rotated and mirrored half teeth:


The graphic above shows rough steps in the final output. This can be somewhat alleviated by using finer steps in the simulation but to really get rid of the steps additional smoothing is required. The step profile occurs in the undercut regions where the backside of the rotated rack tooth profile sticks out as a corner. The smoothing logic is explained in this diagram:


The final result has smooth tooth profiles. As an example below is an image of a calculated gear set (pressure angle 14.5°) consisting of a 30 tooth gear meshing with an 8 tooth gear. Small values for clearance and backlash were used. Head over to the involute spur gear builder page to try it out yourself.




  46 Responses to “Online Involute Spur Gear Builder”

  1. Really interesting. I have written a short review at

  2. Thanks for the thorough review, Ian. In the meantime I extended the tool to also support internal gears and rack & pinion output. Profile shift is supported for all gear configurations as well. The underlying calculations are fairly fast even for higher quality modes and tooth counts. However, the rendering of the graphics is currently killing the performance. I am using the 3d webgl graphics engine that is embedded in the OpenJSCad framework. It is a powerful framework but overkill for rendering 2d graphics. Hopefully eventually I’ll find some time to replace it with a leaner and faster rendering solution.

  3. Hi, Doctor.
    Can you please make the non-circular involute gear available in your tools? I think in your tool , the profile generation is based on the context method,right? I want to study more about non-circular gears’ generation,and have think about writing code for it. but it seems that I do not have such time to do this..(Currently, I am a student who are pursuing p.h.d about gear vibration not gear machining)

  4. Dear,
    I am really excited about this nice tool. I did try to import the generated dxf file intot Autodesk Inventor but Inventor keeps generating an error message. Would you have any experience with this or any hints ?
    kind regards,

    Koenraad Hansen

  5. I was finding the same error with my AutoCAd products. I found that I can import the DXF file into SketchUp.

  6. Dear Dr. Hessmer,

    Is this website only available to your students? I am trying to generate cad models for a machine concept I am working on at work. I searched and found the generator but I can’t see any input dialog boxes or update button. This would be a great tool to use if I could get access to it.



  7. Vernon

    I found this tool will not work with an I-pad but worked fine with my PC.

    Good luck.


  8. What’s the best way to calculate the radius of the gears and the distance between centres of the two gears?

  9. This is amazing! I’m also having trouble importing the .dxf into Vectorworks and into illustrator (only imports as text). Is there some secret to using the DXF files that are produced?

  10. Just an update for anyone else trying to use illustrator or having issues importing into drawing programs. I downloaded Dassault draftsight, opened the dxf generated by this generator, then saved it as 2009, 2010 and 2013 dxf. 2009 and 2010 opened fine in illustrator. Brilliant!

  11. This is great! It has helped me a lot with my project.

    But I do have one question for Dr. Hessmer or anyone else who could help me:
    How is Profile Shift implemented in this builder? I am not interested in programming code, but in equations that make profile shift.
    I would be really grateful if somebody could recommende a book or a web link to this equations?

  12. Hi. When I take the following random values; a pitch of 10, then a pressure angle of 20°, then set the pinion and gear teeth both at 10, leaving all other parameters at zero, then generate a high quality DXF, then overlay the geometry on top of an involute generated in Excel from the basic involute equation, the two don’t overlay precisely. Would you have any idea why? For the data as mentioned, I have calculated the radius of the base circle as (10 * 10) / (2 * PI) * COS 20° , i.e. 14.955672 This is the value plugged into the Excel equation. Am I missing something? This is all new to me.

    Here’s the involute equation I used.

    x=r*(cos theta + theta * sin theta)
    y=r*(sin theta – theta * cos theta)

    Just one other question. Again analysing your output geometry for the data above, then again after adding a 0.5 offset, the overlay shows a perfectly offset involute profile which I expected to see. However am I right to assume that the involute offset should be equal to ((addendum * (1 + offset )) – addendum) * SIN 20° When I create the geometry using Excel again they don’t overlay. I’m taking the Addendum as 10 / PI in my example. I would be glad to share my files with you if I had an email to send them to. Thanks

  13. Nice software tool!

    I found that the dxf output file can be opened in Inkscape (freeware on al platforms) and then saved in any vector format (I use eps) Opening the file in Adobe Illustrator is an easy next step.

  14. Has anyone yet proved the output geometry to be true?

    The author hasn’t replied to my previous post.

    I still cannot get it to agree with my own results.

    I just want to know if this is reliable and if so, then I need to search further to find the fault in my own construction geometry.

    I have modeled it both in 3D software with a simulated rack cutter operation, and also via Excel generated involutes, and my two end results agree to within 0.00001


  15. Very nice piece of work, but for some unknown reason I don’t seem to be able to achieve a
    download .dxf file. When I select the update, post input of data, picture depicts my input. But
    upon selecting generate dxf file it offers download dxf, but nothing happens when I select it.
    Any help would be greatly appreciated. Don’t believe I have any options in IE that would prevent
    download from taking place, often download files from other web sites.

  16. I also have trouble opening the .dxf file in bot illustrator CS6 and autoCAD 2014. Has anyone found a fix that doesn’t involve more programs? Seems weird to as both illustrator and autocad usually works with every file I throw at them…

    The tool itself is effin great!

  17. This is a superb online tool. However, I am having trouble generating a High resolution .dxf file for Internal Tooth Spur Gears. The only resolution I can get is Draft resolution. If you have a solution to this, that would be great. I may also be doing something incorrect. I have no problems importing the .dxf into my PC’s Turbocad 11.2. My Turbocad version does NOT do Internal Tooth Spur Gears.

    And thanks again for the great tool.

    • I just posted an updated version that splits the former Quality setting into two separate settings:

      – Rotation steps per tooth angle (default 3)
      – Number of segments per 360 degree of rotation

      Particularly the first one is relevant and gives you more control over the desired quality. Increase the value slowly since the calculation time increases non-linearly with larger values.

  18. Sooo close. This is an exciting tool, but sadly, doesn’t seem to be working all that well. The tool is crashing on anything besides Draft, with these parameters (in order):

    0.065449847 (i.e. 48DP gear)
    Wheel 1 Only

    And, even in Draft mode, I can only zoom in to the point that the gear is the size of pea in the middle of the viewing window.

    It would be great if we could just set Inch/Metric Module (much more intuitive/normal) instead of using Circular Pitch.

    This seems to work better with huge-sized gear inputs, not small gears.

    This is the most promising Involute generator I’ve found on the web so far, but it’s not quite done.

  19. Also, it makes me a bit nervous that the DXF file is named “CycloidalGear_1.dxf” and not Involute…two very different things…are we sure that this is an Involute profile and not a Cycloid?

  20. Brilliant.
    I am using geomagic (formerly alibre). When you open up the dxf file, it brings it into a drawing file. You have to explode symbol. You can then copy and paste it into a model space where it can be extruded. I am using it to 3D print nylon gears. Takes no time at all

  21. I love this tool, and have used it extensively in building a prototype device. Now I have a problem: I am trying to build a planetary set with tooth counts of 70, 28 and 14, with a pitch of 8. I have no problem with the 28 and 14 tooth gears, but when I enter -70 for the ring gear I get the following error message:

    Error: Area is not closed!
    at Object.CAG.getOutlinePaths (http://hessmer.org/gears/OpenJsCad/csg.js:6083:12)
    at Gear._createInternalGearShape (blob:http%3A//hessmer.org/8205b434-81c1-433e-8bde-dea01c51a264:352:37)
    at Gear._createZeroedShape (blob:http%3A//hessmer.org/8205b434-81c1-433e-8bde-dea01c51a264:147:19)
    at Gear.getZeroedShape (blob:http%3A//hessmer.org/8205b434-81c1-433e-8bde-dea01c51a264:138:31)
    at GearSet.createShape (blob:http%3A//hessmer.org/8205b434-81c1-433e-8bde-dea01c51a264:601:35)
    at main (blob:http%3A//hessmer.org/8205b434-81c1-433e-8bde-dea01c51a264:42:25)
    at Function.OpenJsCad.runMainInWorker (http://hessmer.org/gears/OpenJsCad/openjscad.js:387:18)
    at DedicatedWorkerGlobalScope. (blob:http%3A//hessmer.org/8205b434-81c1-433e-8bde-dea01c51a264:678:96)

    Am I doing something wrong?

    • I tried it with the following parameters which worked for me. Can you try again and if you get stuck, send me the complete set of parameter values you use for the -70 gear?

      Circular pitch (the circumference of the pitch circle divided by the number of teeth):
      Pressure Angle (common values are 14.5, 20 and 25 degrees):
      Clearance (minimal distance between the apex of a tooth and the trough of the other gear; in length units):
      Backlash (minimal distance between meshing gears; in length units):
      Profile Shift (indicates what portion of gear one’s addendum height should be shifted to gear two. E.g., a value of 0.1 means the adddendum of gear two is increased by a factor of 1.1 while the height of the addendum of gear one is reduced to 0.9 of its normal height.):
      Wheel 1 Tooth Count (n1 > 0: external gear; n1 = 0: rack; n1 < 0: internal gear): -70 Wheel 1 Center Hole Diameter (0 for no hole): 4 Wheel 2 Tooth Count: 8 Wheel 2 Center Hole Diameter (0 for no hole): 4 Show: Rotation steps per tooth angle when assembling the tooth profile (3 = draft, 10 = good quality). Increasing the value will result in smoother profiles at the cost of significantly higher calcucation time. Incease in small increments and check the result by zooming in. 6 Number of segments per 360 degree of rotation (only used for circles and arcs); 90 is plenty: 100

  22. Hello!

    I have a problem with openning in my Autocad generated DXF. It says “Table flags missing on line 32.”

  23. This is great!
    Do you have any plans to add SVG output?

  24. The code heavily relies on OpenJsCad/csg.js which only supports dxf output. You can however, import the generated dxf file into Inkscape and then save it as svg.

  25. Hello

    I have been using your application to generate gear profiles for a wooden clock – these will be milled via Cut2D (Vectric). The dxf files import faultlessly into Cut2D – this is great stuff!! I also tried to import into Autosketch in order to add crossing out detail to the gears. Unfortunately this gives an error message “Table flags missing on line 32.”.

    Not being an expert in DXF file syntax, I have no idea how to fix this. Are you able to offer any suggestions as to how to correct/change the file. DXF’s generated in Autosketch do import correctly into Cut3D.

    Help would be much appreciated.


  26. Hello,

    Thank you for that guidance – Inkscape solved the problem completely. What an awesome piece of software that is – and all for free as well. I really must take the time to learn to use it effectively.

    I must say a thanks too for the gear profile generators – just what a hobbyist need for fun projects.

  27. I can not get a DXF file without an error for the External Spur Gear Generator.
    Love the program. Its brilliant but I must be doing something wrong.
    I input:
    Circular Pitch 4.86440153
    Pitch Angle 10
    Clearance .03
    Backlash .010
    Profile Shift .15
    Wheel #1 N 31
    Bore Diameter 4
    Wheel #2 N 11
    Bore Diameter 3
    Last two values tried 10 and 90 but did not work even 3 and 30 did not work.
    I see the image and it appears to be generating the correct graphics.
    Thanks for any help you can provide.

  28. I want to thank you for this gear generator. I spent the better part of a couple of days learning everything about gear design and the math behind it for some wooden gears and locking mechanism (rack & pinion setup) I was commissioned to make for a client who’s got a closet for his Batman suit and weapons (no, I’m not kidding it’s a fully wearable Batman suit). Then sometime last night while taking a coffee break, found this generator and it gave me exactly what I needed!!

    It took me a minute to figure out the measurements to input were in mm and not inches and kept getting strange things, so maybe add in a note or something.

    Downloaded the DXF into TurboCAD (no issues at all) and then into illustrator (also into AutoCAD just to check) and from there into my CNC programs (ArtCAM8 Pro and MACH3). Will be cutting them out later, but thanks again for saving my bacon.

  29. I ported your JavaScript to C++ and OpenGL. If you do not object, I would like to share the result. I initially was going to make it an Inventor addin, but it was far simpler to export as a spline based DXF and import that to Inventor.

  30. I noticed that there are some jagged lines in the gears, even with 10 step/tooth and high resolutions. I found that running _smoothConcaveCorners one additional time removed the artifacts.

  31. Hello,
    I’m trying to generate a planetary gear with -240 teeth but the builder ‘s script blocks ! I genarated with the same builder last june other planetary gears with 360 teeth without any problem … What’s wrong ?
    Thank you, ciao !

  32. […] The gear meshing with the lantern gear is created by tracking how the lantern gear pins cut into the disk of the matching gear. As an example, the image on the right shows the path of one lantern pin moving clockwise into the 3 o’clock position. The same circles, pinned to the matching gear, create the shape of a half tooth as the matching gear turns counterclockwise at a speed defined by the gear ratio. (I use the same mechanism for the involute spur gear builder). […]

  33. Hi,
    We’ve got a feature request for you to think about, please.
    We love Gear Builder, thank you. Here’s an example of where we used it: http://sheetcnc.co.uk/strandkrab/ These toys will be heading to Maker Faire UK in a couple of weeks. The gears of this and many of our other projects were designed on Gear Builder. So thank you!
    The StrandKRAB gears are CNC’d, which means they naturally have a radius at the bottom of the teeth. This radius can foul the tips of the meshing teeth. To prevent fouling we could instruct the CAM to overcut the corners, but this causes sideways cutting and results in very weak roots. Alternatively we can increase the clearance setting in Gear Builder. Increasing the clearance moves the radius deeper into the wheel where it won’t foul anything. Which is great… but we don’t really know how much clearance we should add. It’d be nice if Gear Builder could take our cutter CED as input and then compensate with additional clearance automatically in the designed wheel. Does that sound worth doing?

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>