DEV Community

Li Lu
Li Lu

Posted on

I Built a CNC Machining Calculator — Here's the Engineering Behind It

By Li Lu — Machining Development Engineer at GE Vernova, Singapore

After more than 10 years in CNC machining — first as a machinist and tooling setter, then as a technical supervisor, and now as a machining development engineer in advanced manufacturing and repair technology — I still find myself doing the same quick parameter checks every day at the machine. Spindle speed for this diameter. Feed rate for this cutter. Is this MRR realistic for the material?

Paper catalogs and apps exist, of course. But I wanted something transparent: a tool where every number comes from one clearly stated formula, is unit-tested, and can be audited by anyone. So I built a web-based CNC machining calculator — free, no account, no ads — and open-sourced it on GitHub.

This article explains the six calculations behind it, with worked examples.

1. Spindle Speed

The most-used formula on any shop floor:

n = (1000 × Vc) / (π × D)
Enter fullscreen mode Exit fullscreen mode
  • n = spindle speed (RPM)
  • Vc = cutting speed (m/min)
  • D = tool or workpiece diameter (mm)

Example: machining with a Ø12 mm carbide end mill, Vc = 180 m/min:

n = (1000 × 180) / (π × 12) ≈ 4,775 RPM
Enter fullscreen mode Exit fullscreen mode

2. Feed Rate

F = fz × z × n
Enter fullscreen mode Exit fullscreen mode
  • F = feed rate (mm/min)
  • fz = feed per tooth (mm/tooth)
  • z = number of cutting teeth
  • n = spindle speed (RPM)

Example: continuing from above, with fz = 0.08 mm/tooth and a 4-flute cutter:

F = 0.08 × 4 × 4,775 ≈ 1,528 mm/min
Enter fullscreen mode Exit fullscreen mode

3. Feed per Tooth

The same relationship rearranged — useful when you know the machine's actual feed and want to check whether your chip load is sane:

fz = F / (z × n)
Enter fullscreen mode Exit fullscreen mode

Running a 4-flute cutter at 1,528 mm/min and 4,775 RPM gives fz ≈ 0.08 mm/tooth. If you get far below that on a rigid setup, you are rubbing, not cutting.

4. Cutting Speed

When you inherit a program with unknown parameters, back-calculating Vc tells you how aggressively it was written:

Vc = (π × D × n) / 1000
Enter fullscreen mode Exit fullscreen mode

5. Material Removal Rate (MRR)

MRR = ae × ap × F
Enter fullscreen mode Exit fullscreen mode
  • ae = width of cut (mm)
  • ap = depth of cut (mm)

Example: ae = 6 mm, ap = 2 mm, F = 1,528 mm/min:

MRR = 6 × 2 × 1,528 ≈ 18,336 mm³/min
Enter fullscreen mode Exit fullscreen mode

MRR is the number I use most when comparing two process options — it converts "feels faster" into comparable figures.

6. Drilling Parameters

For drilling, spindle speed uses the same Vc/D relationship (with D as drill diameter), and feed comes from feed per revolution:

n = (1000 × Vc) / (π × D)
F = fr × n
Enter fullscreen mode Exit fullscreen mode

Example: Ø10 mm HSS drill in steel, Vc ≈ 30 m/min, fr = 0.2 mm/rev:

n ≈ 955 RPM,  F ≈ 191 mm/min
Enter fullscreen mode Exit fullscreen mode

The Software Side

Being an engineer who writes code is a genuinely useful combination, and this is where the tool goes beyond a spreadsheet:

  • Modular Python 3.12 — every formula above is its own small, reusable function (spindle_speed.py, feed_rate.py, mrr.py, …)
  • pytest unit tests — calculation accuracy and input validation are covered by an automated test suite
  • GitHub Actions CI — every push to main runs the tests automatically; a broken formula cannot ship silently
  • GitHub Pages deployment — a separate workflow publishes the web interface, so the live tool is always in sync with the tested code
  • Pure HTML/CSS/JavaScript front end — no frameworks, loads instantly even on a shop-floor tablet

I designed it the way I wish more engineering tools were designed: the calculation layer is auditable, tested, and separate from the interface.

Important: These Are Reference Values

Every machinist knows the formula is only the starting point. Real parameters must account for:

  • workpiece material and hardness
  • tool material, geometry and coating
  • machine capability and rigidity
  • workholding and tool sticking-out
  • coolant and chip evacuation
  • the tool manufacturer's own recommended ranges

The calculator gives you the mathematically correct number; process judgment remains yours. That disclaimer is deliberately the first thing the tool states.

Try It

Planned next: turning-specific calculations, unit conversion, reset buttons per calculator, and broader test coverage.

About Me

I am a Machining Development Engineer at GE Vernova's Advanced Manufacturing & Repair Technology (AMRT) center in Singapore, with 10+ years of experience across CNC machining, process development and qualification, CNC machine integration, fixture design and repair technology — progressing from CNC machinist to technical supervisor to development engineer.

My interest is the intersection of manufacturing engineering and software: using code to make engineering knowledge transparent and reusable.

Feedback and contributions are welcome — especially from other machinists who want different calculations covered.

Top comments (0)