Rewrite Legacy System or Refactor: TCO Over 12-24 Months

Supporting an old system often seems cheap until you factor in slow release cycles, the high cost of rare specialists, and lost revenue. We calculate the TCO of a full rewrite versus incremental refactoring head-to-head.

SMMAK Editorial Team · Published · Updated · 9 min read

Rewrite Legacy System or Refactor: TCO Over 12-24 Months
Quick answer

Rewriting a legacy system is often beneficial when the annual cost of ownership (support, downtime, slow releases, lost revenue) exceeds 35-50% of the rewrite budget, and the core functionality isn't covered by off-the-shelf products. If the system is stable and rarely changes, refactoring or incremental replacement (strangler pattern) is typically more cost-effective than a complete overhaul.

Key takeaways
  • The decision isn't about code age, but the cost per change and the budget percentage consumed by maintenance instead of development.
  • A full rewrite typically pays off in 18-30 months, and only if the core system is truly unique and changes frequently.
  • For most companies, the best approach is a gradual strangler pattern combined with purchasing off-the-shelf modules.
  • Hard-stop reasons for a rewrite include inability to hire, unpatched vulnerabilities, scaling limitations, and blocked revenue streams.
  • Base your decision on a 24-month model with a pessimistic scenario: rewrites almost always exceed initial estimates in cost and time.

The most expensive line item in an IT budget often isn't explicitly listed: it's the difference between what your team could be releasing and what it actually releases because it's afraid to touch old code. The question "rewrite legacy system or refactor" cannot be decided based on a reluctance to discard existing work. It must be decided based on Total Cost of Ownership (TCO) over a 12-24 month horizon. Below, we break down how to calculate this and who wins in which scenario.

A candid disclaimer upfront: there's no universal answer like "70% of cases require a restart." The benefit depends on four variables: cost of change, proportion of budget spent on maintenance, uniqueness of logic, and availability of talent. A full rewrite can be the most expensive solution possible.

Why Legacy System Maintenance Appears Cheap But Costs a Fortune

Maintenance seems cheap because only the direct costs—salaries and hosting—are visible. The hidden costs are many times greater and often don't appear in the "IT" budget.

Invisible Cost Categories:

  • Slowed Development. A task that takes 2 days in a modern architecture might take 2 weeks in a monolithic system without adequate tests.
  • Cost of Rare Specialists. Developers proficient in outdated tech stacks are 20-50% more expensive and take longer to find (typically 3-6 months per position).
  • Incidents and Downtime. Every hour of unavailability in e-commerce or logistics has a direct price tag in lost revenue.
  • Missed Opportunities. Integration with a marketplace, payment service, or AI module is delayed for quarters.
  • Key Person Risk. A single employee who "knows how it works" is not an asset but an unmitigated liability.

The integral metric: Cost per Change. If it increases quarter-over-quarter with the same team, your technical debt is already charging interest from your revenue.

How to Assess Technical Debt in 2 Weeks

Technical debt can be quickly assessed by measuring money and time, not just code quality. You need five metrics.

  1. Lead time for changes: from idea to production, in days.
  2. Maintenance burden: the percentage of team hours spent on bugs and manual operations, rather than new features.
  3. Change failure rate: the percentage of releases that cause a rollback or an incident.
  4. Bus factor: how many people understand critical modules.
  5. Test and documentation coverage of critical workflows.

Formula for Annual Technical Debt Tax:

Tax = (Hours spent on maintenance and workarounds × hourly rate) + (Downtime × cost per hour) + (Lost margin from delayed features)

If the maintenance burden in your development budget exceeds 60-70%, and lead time has doubled in two years, you are in a zone requiring a structural response, not just another patch.

Refactoring vs. Rewrite: A Head-to-Head Comparison of Approaches

In reality, there aren't two options, but four. Here's a comparison by key criteria:

Criteria"As Is" MaintenanceRefactoring + StranglerFull RewriteOff-the-Shelf Product
Initial CostsMinimalModerateHighModerate (licenses + implementation)
Time to First ValueWeeks2–4 months9–18 months3–9 months
Project Failure RiskLowModerateHighModerate (process adaptation)
Speed of Change (24 mo.)DeclinesIncreasesHigh, if architecture succeedsVendor-limited
Team RequirementsOld stack expertsStrong architect, DevOpsFull-stack product + engineering teamIntegrator, process owner
Best ifSystem is stable, changes rarelyBusiness is dynamic, core is valuableCore is outdated and uniqueLogic is standard (accounting, CRM, ERP)

The main takeaway from the table: a full rewrite is the only option with high risk and delayed value. It's justified only when the other three options are exhausted.

What's the Cost of Rewriting Software From Scratch vs. Maintaining Old Code? A 24-Month Model

Below is an illustrative example (not a real client) to demonstrate the calculation logic. The numbers are hypothetical; substitute your own.

Situation. A logistics company has an 11-year-old proprietary order and routing management system. The support team consists of 6 people, with an all-in cost of $10,000 per person per month, totaling $720,000 per year.

Option A: Maintain and Enhance.

  • Support and enhancements: $720,000 × 2 years = $1.44 million.
  • Downtime and incidents: ~6 major incidents per year × $10,000/incident = $120,000 over 2 years.
  • Lost margin (two features delayed by 9 months, ~ $50,000 margin per month each): ~$900,000.
  • Support cost growth +15% per year: an additional ~$108,000.
  • Total TCO for 24 months: ≈ $2.568 million.

Option B: Full Rewrite.

  • Development: 10-person team × $12,000/month × 14 months = $1.68 million. With a 30% buffer for overruns (typical for rewrites): ≈ $2.184 million.
  • Parallel support for the old system for 14 months (team reduced to 3): $10,000 × 3 × 14 = $420,000.
  • Support for the new system for the remaining 10 months (4 people): $400,000.
  • Data migration, training, parallel launch: ~$200,000.
  • Total TCO for 24 months: ≈ $3.204 million.

Over a 24-month horizon, the rewrite loses by almost $636,000. Now consider a 48-month horizon: supporting the new solution with 4 people costs $480,000 per year versus $720,000+ (and growing) for the old one. This represents an annual saving of ~$240,000-$360,000, plus accelerated revenue. Break-even occurs approximately at months 30-36.

Option C: Strangler Pattern (Phased Replacement). Isolate routing into a separate service in 5 months (≈ $500,000), then orders. TCO for 24 months ≈ $2.8-$3.0 million, with tangible benefits appearing as early as the 6th month. For this company, this is likely the best option.

ROI Formulas for a Rewrite Project

  • Payback Period (months) = Cost of Rewrite ÷ (Monthly Support Savings + Monthly Additional Margin)
  • Break-even Threshold: A rewrite is justified if the annual technical debt tax ≥ 35–50% of the rewrite budget.
  • Always calculate two scenarios: a baseline and a pessimistic one (+40% to timelines and budget).

When to Replace an Old System: Hard-Stop Reasons

There are situations where "enhancement" is no longer an option. These are not matters of preference.

  • Inability to Hire or Retain Talent: The technology stack is obsolete, and the sole knowledge holder is leaving.
  • Security and Compliance: The platform is unsupported, vulnerabilities cannot be patched, and regulatory requirements cannot be met.
  • Scaling Ceiling: The system cannot handle seasonal load, and vertical hardware scaling options are exhausted.
  • Revenue Blockage: It's impossible to launch a channel, integration, or product essential for growth plans.
  • End-of-Vendor Support for a critical component (database, platform, OS) with no migration path.

If two or more of these points apply, delaying the decision will be more costly than making a mistake in its execution.

When NOT to Rewrite: Pros and Cons of Rewriting Software

Pros of a Rewrite: Clean architecture, modern tech stack, easier hiring, faster changes, ability to integrate AI and APIs.

Cons and Pitfalls:

  • You pay twice: for the new system and for supporting the old one during the transition.
  • The old system contains years of implicit business rules that no one documented. These are often the first things lost during a rewrite.
  • The "second system effect": the team tries to build a perfect product and gets bogged down in scope.
  • Business doesn't stand still: over 14 months, requirements change, and the goal shifts.

Do NOT rewrite if: the system is stable and changes less than once per quarter; the problem lies in processes and management, not the code; there is no owner with the mandate and budget for 24+ months; the logic is standard and can be covered by an off-the-shelf product.

Risks of Legacy ERP Replacement: Why ERP Is Different

Replacing an ERP is the riskiest type of rewrite. It simultaneously affects finance, inventory, procurement, and production, so errors are felt across the entire company. Typical failures include: attempting to replicate old processes 1:1 in the new system, underestimating data migration, and a lack of process owners.

For standard functions (accounting, inventory, procurement), it's usually more cost-effective to buy and configure, only building custom solutions for differentiating logic. We offer in-depth expertise through our ERP implementation services. For comprehensive marketing and call analytics, where custom solutions are often unnecessary, our SMMAK ERP might be a suitable fit.

How to Mitigate Risks During a Full Restart: A Strategy for Working with Legacy Code

Successful restarts share common patterns. So do failures.

  • Avoid a "big bang" launch. Roll out by customer segments, regions, or functions.
  • First, characterize behavior. Write automated tests for existing behavior before touching the code; they will serve as your specification.
  • Document implicit business rules from code and interviews with operators.
  • Freeze the scope for an MVP that covers 80% of workflows, deferring rare use cases.
  • Run parallel operations for 1-3 months with automatic reconciliation of results.
  • Allocate a 30-40% reserve for timelines and budget, and agree on it with your CFO in advance.

Rewrite Readiness Checklist

  • Annual technical debt tax calculated in dollars
  • Business owner with decision-making authority and 24-month budget is in place
  • Critical business rules are documented
  • Automated tests or golden data sets for reconciliation exist
  • MVP defined and a phased rollout plan is in place
  • Support for the old system during the transition period is planned
  • The team has experience with similar migrations
  • The pessimistic scenario (+40%) still offers ROI within 36 months

What Do Major Failures and Successes in Rewrites Show?

The public history of the industry offers a recurring lesson: complete "from scratch" rewrites without phased rollouts more often run over time and budget. Success goes to companies that incrementally replaced old systems, chunk by chunk, while keeping the business operational. A well-known example from browser history is a complete product rewrite that halted development for years and ceded market share to competitors. Conversely, major platforms migrated from monoliths to services gradually, function by function. We do not provide specific figures from other projects, as they are rarely fully disclosed, and conclusions depend heavily on context.

A Step-by-Step Decision Plan for CEOs and CTOs: 6 Steps in 6 Weeks

  1. Weeks 1–2: Measure. Lead time, maintenance burden, change failure rate, bus factor, technical debt tax in dollars.
  2. Week 3: Segment the system into core (unique logic), standard modules, and dead weight.
  3. Weeks 3–4: Compare options. For each module, choose: keep, refactor, buy, or rewrite.
  4. Week 5: Build a 24- and 48-month model with baseline and pessimistic scenarios and a break-even point.
  5. Week 5: Check hard-stop reasons and compliance risks.
  6. Week 6: Make a decision and define success metrics: target lead time, maintenance burden below 40%, first release within 4 months.

Rules for Choice: Who Wins in Which Scenario

  • System is stable, changes are rare: Maintenance with minimal refactoring wins.
  • Valuable core, but slow changes: Refactoring and the strangler pattern win.
  • Standard logic (accounting, CRM, inventory): Buying an off-the-shelf product wins.
  • Outdated unique core, hard-stop reasons present: A rewrite wins, but it must be phased.
  • No business owner and no 24-month budget: The best choice is to do nothing until these are in place.

If you need an independent assessment of your architecture and TCO model, the SMMAK IT Product Development team typically begins with a two-week audit, providing a detailed calculation for each module before you commit to a rewrite budget.

Next Step

This week, gather three figures: how many hours your team spends on support, the cost of one hour of downtime, and which features are delayed due to system limitations. Plug these into the technical debt tax formula. If the annual result is more than a third of the estimated rewrite cost, it's time to assemble a 24-month model and discuss a phased plan, rather than just another patch.

Frequently asked questions

How much does it cost to rewrite software from scratch?

As a guideline: the cost equals (team size × duration) + 30–40% buffer + parallel support for the old system. For an average enterprise system, this typically means 12–18 months of work for a team of 8–12 people. An exact figure can only be provided after an audit of modules and the scope of business rules.

How long does it take for a rewrite project to pay off?

In B2B practice, the payback period for a complete rewrite is typically 18–36 months. It depends on savings from maintenance and additional margin from accelerated changes. If the pessimistic scenario (+40% to budget) does not pay off within 36 months, a phased approach is usually better.

What's better: refactoring or a complete restart?

For most companies, refactoring with phased replacement (strangler pattern) is better: benefits appear within 2–4 months, and the risk is lower. A complete restart is justified when the core is unique, technologically obsolete, and there are hard-stop reasons such as security, hiring difficulties, or scaling limitations.

How do I know when it's time to replace an old system?

Signals include: the cost per change increases with the same team, over 60% of hours are spent on maintenance, releases are frequently rolled back, there's only one key expert, and integrations with new channels are delayed for quarters. Two or more hard-stop indicators mean further delay is too costly.

Why do rewrites so often fail?

Reasons include: loss of implicit business rules, bloated scope, paying for two systems simultaneously, changing requirements over time, and a "big bang" launch without phased transitions. Risks are mitigated by testing existing behavior, an MVP covering 80% of workflows, parallel launches, and a 30–40% budget reserve.

Should I replace a legacy ERP or buy a new one?

For standard processes (accounting, inventory, procurement), it's usually more cost-effective to buy and configure an off-the-shelf solution than to build from scratch. Custom development is only worthwhile for differentiating logic. Main risks of replacement include: replicating old processes 1:1, complex data migration, and a lack of process owners.

About the author: SMMAK Editorial Team, Expert Editorial Team in Marketing, AI & ERP

The SMMAK Editorial Team publishes guides on performance marketing, AI implementation, ERP systems, and business process automation. Articles are grounded in hands-on client projects, including the development of the SMMAK ERP cloud platform for AI-powered analytics of marketing data and call center calls. The focus is on practical solutions that help businesses measure and grow revenue.

Want to implement this in your company?

Our team will assess your case and prepare a roadmap with budget and expected ROI — for free.

By submitting the form you agree to the processing of personal data.

Related articles