Every refactoring project starts the same way: an engineer says "we really need to clean this up" and a manager says "how long will it take?"
What the engineer hears is "give me a time estimate." What the manager actually means is "give me an ROI."
Those are not the same answer. Here is how to give the second one.
The four numbers you need
A refactoring ROI calculation has exactly four inputs:
- Investment — what the cleanup will cost, in euros.
- Monthly savings — how much the cleanup will reduce recurring firefighting and debt servicing, per month.
- Break-even point — investment divided by monthly savings, in months.
- Confidence interval — the range around each estimate.
That's the whole framework. Everything else is filler.
Computing the investment
Take the scope of the refactoring and break it into tangible deliverables. For each:
- How many engineer-days? (Include code review, testing, migration.)
- Daily cost? (Use your fully-loaded rate — typically €450 in Europe.)
- Multiply. Sum. Add 20% buffer.
A typical hotspot refactoring runs €5k–€15k in engineering cost. A cross-cutting refactor across several modules can reach €50k–€150k.
Computing the monthly savings
This is the part most engineers underestimate. Savings come from four sources:
Reduced firefighting
If the refactored area currently generates N bug-fix commits per month, and each commit averages half a day of engineering (fix + test + deploy), you are burning N × €225 per month. A successful refactoring often halves that number.
Reduced blocking time
When a file is fragile, engineers avoid touching it. They route around it. Features take longer. This is hard to measure directly but very real: add an estimated 10–20% overhead to adjacent work.
Reduced knowledge-silo risk
If the refactoring breaks up a silo (one person owning critical code), the savings are harder to forecast but easier to justify. "Bus factor" events — that person leaves, gets sick, burns out — have probability, and their cost is measured in weeks of productivity loss for the rest of the team.
Faster onboarding
Every new engineer who joins the team will not need to navigate the refactored area. If you hire one engineer per quarter, that's four days saved per year per refactoring — often €1,800/year per cleaned-up module.
A worked example
Assume you are refactoring a payment gateway module that:
- Generates 6 bug-fix commits per month, each ~0.5 days of work
- Is owned by one engineer (85% commit concentration)
- Has 420 lines and cyclomatic complexity 38
- Takes about 12 engineer-days to refactor (including tests and migration)
Investment: 12 days × €450 × 1.2 buffer = €6,480
Monthly savings:
- Firefighting reduction: 6 × 0.5 × €450 × 0.5 (halving) = €675/month
- Adjacent blocking: ~€350/month
- Silo dissolution: hard to price, say €200/month in amortized risk
- Total: €1,225/month
Break-even: €6,480 / €1,225 = 5.3 months
Annual ROI: (12 × €1,225 − €6,480) / €6,480 = 127%
That is a number you can put on a slide. That is a number a CFO can approve.
Where this breaks down
Three situations where this framework lies to you:
- Refactoring that doesn't fix the underlying problem. If you clean up syntax but leave the architecture broken, savings will be far smaller than forecast.
- Refactoring that introduces new bugs. Always include migration cost and rollback plan.
- Refactoring no one uses. If the area being refactored is not actually on the critical path for upcoming work, the "blocking time" savings are zero.
The honest version
Refactoring ROI is always an estimate. Your savings could be 50% lower than you predict. They could also be 50% higher. What matters is that you've made a specific, falsifiable claim instead of "it feels like the right thing to do."
Specificity is what separates a budget approval from a polite brush-off.
Make the claim. Put it in writing. Measure it afterwards. Repeat.