Everyday Systems April 26, 2026

How Does Package Delivery Routing Work?

A 7-minute read

When you type an address, an algorithm calculates the fastest route across hundreds of stops. The math underneath is fiendishly hard, but the solution shapes whether your package arrives on time.

You type in an address, pay for shipping, and expect the package in two days. What happens between that click and delivery is one of the most complex logistical puzzles in the modern economy. A delivery driver in a major city might make 150 stops in a single shift. Each route has to hit every address, obey time windows, avoid traffic, and do it in the fewest miles possible.

That problem is harder than it sounds.

The short answer

Package delivery routing solves a variant of the Traveling Salesman Problem: find the shortest route through hundreds of stops with real-world constraints like time windows, vehicle capacity, and road restrictions. Exact solutions for large problems do not exist, so routing systems use approximation algorithms, real-time data, and heuristics to find good enough routes quickly. The results determine whether your package arrives on time and how much you pay for shipping.

The full picture

The math underneath

The core problem is called the Traveling Salesman Problem (TSP). Given a list of cities and the distances between each pair, find the shortest route that visits every city exactly once and returns to the start. The TSP is one of the most studied problems in computer science, and for good reason.

The TSP is NP-hard, which means there is no known fast algorithm that guarantees the best solution for large sets of stops. A driver with 100 stops has more possible routes than there are atoms in the observable universe. Checking every route is not an option.

Instead, routing systems use approximation algorithms. The nearest neighbor heuristic picks the next closest stop from the current position. It is fast but produces routes roughly 25% longer than optimal.

Better approaches use algorithms like Google OR-Tools, which applies local search with neighborhood reduction. OR-Tools starts with a random route and repeatedly tries swapping, moving, or reversing segments of the route to find improvements. Each iteration tests thousands of modifications, settling on a result that is close to optimal without exhaustively checking every possibility.

For very large problems, like planning routes for an entire delivery fleet, routers use a technique called Clarke and Wright savings. The algorithm computes the cost savings from combining pairs of routes, then merges the most efficient combinations first. This produces near-optimal fleet-level routes in seconds rather than hours.

What the router actually knows

A modern routing system does not simply know addresses. It knows:

  • Delivery time windows: “deliver between 9am and 12pm” is a hard constraint that the router must honor
  • Package count and weight: a truck with a 10-stop limit on heavy packages may need to stop early
  • Driver schedules: breaks, shift end times, and home addresses for start and end points
  • Road restrictions: one-way streets, weight limits, low bridges, and no-left-turn intersections
  • Historical traffic: which roads are slow at 8am versus 3pm

This is not abstract. UPS’s ORION system, which handles routing for hundreds of millions of packages annually, was refined over years of real-world data collection, as documented by Supply Chain Nuggets reporting on the ORION algorithm. ORION cut 100 million miles from UPS routes each year and saved $300 to $400 million annually, while reducing emissions by 100,000 metric tons per year.

The Wikipedia article on the Vehicle Routing Problem describes how the academic formulation evolved to include capacity, time windows, and multiple depots, bridging the gap between the abstract TSP and real-world logistics.

The last-mile problem

Long-haul transport is relatively simple. A truck drives down a highway at a known speed and arrives at a sorting facility. The hard part is the last mile: getting a package from the local depot to your door in a limited window.

Last-mile routing has several features that make it hard:

  • Dense stops: a driver might cover 100 to 150 addresses in a 4-hour shift
  • Time windows: e-commerce has conditioned customers to expect narrow delivery windows
  • Mixed loads: the same truck carries a 2kg shoebox and a 20kg dog food bag, constrained by total weight and volume
  • Return trips: undeliverable packages need a planned path back to the depot

No routing algorithm handles all of these perfectly. Real-world systems balance theoretical optimization against driver experience. Drivers often deviate from the planned route to avoid a new road closure or finish a cluster of stops in a logical order. A good routing system gives drivers a plan that is right most of the time and flexible enough to be useful the rest of the time.

What this means in real life

Routing efficiency is a direct cost in your shipping bill. Every unnecessary mile driven, every U-turn, and every empty seat in a truck adds to the cost per package. When UPS cut 100 million miles per year from its route network, the savings translated into lower costs that could be passed to customers or kept as profit.

The growth of two-day and even same-day delivery is partly a story about routing improvement. Better algorithms, combined with dense depot networks and optimized load planning, brought the per-delivery cost of local shipping low enough that fast delivery became economically viable at scale. A route that used to cost $8 to $10 per stop in driver time can now be planned for $2 to $3 per stop, as logistics industry data shows, because better routing achieves higher stop density and fewer wasted miles.

When routing fails, you feel it. A missed time window is often a routing system that underestimated traffic or got the time windows wrong. A late delivery on a Friday that was promised for Thursday is often a routing plan that deprioritized that stop because of constraints that changed.

Routing and modern e-commerce

The growth of online shopping has pushed routing systems to their limits. A surge in order volume in a single zip code creates a routing problem with more stops than the system can handle with a single truck.

Carriers solve this by batching: grouping orders by zone and assigning them to drivers in rotation. But batching introduces its own inefficiency, because orders placed at the last minute may not fit the planned route.

Amazon has invested heavily in dynamic routing to handle this. Their system can replan a driver’s route in real time as new orders arrive, using algorithms like the ones Google’s OR-Tools documentation describes. The open-source library provides vehicle routing problem solvers that Amazon and others build on.

This is also why weekend delivery windows are so narrow. Routing plans are built for a fixed number of stops per driver. When volume spikes, the system is running at capacity and has little flexibility to absorb new orders without rescheduling.

Why it matters

Routing matters because it determines the cost and reliability of last-mile delivery, which is the most expensive mile in the supply chain.

Last-mile delivery accounts for roughly 53% of total shipping costs, as logistics research consistently shows. Improving routing efficiency is one of the primary levers carriers pull to reduce that cost.

For consumers, routing determines whether you get your package on time. A routing system that misses traffic patterns or ignores time windows will consistently miss delivery promises. Understanding how routing works helps explain why some deliveries are on time and others are late.

For businesses, routing efficiency is a competitive factor. A small retailer with a well-planned local delivery route can compete with a large carrier that has optimized routing at scale. Understanding routing helps you negotiate shipping contracts and design fulfillment strategies that work with carrier routing, not against it.

Common misconceptions

“Routing systems find the optimal route.” Routing systems find a route that is good enough, computed fast. Exact optimal solutions for large routing problems do not exist in a useful timeframe. Even UPS’s ORION, one of the most sophisticated commercial routing systems, uses approximation algorithms, not exhaustive search.

“Traffic is the main cause of late deliveries.” Traffic is a factor, but routing plan errors are more common. A plan built on wrong assumptions about stop duration, package count, or time windows causes more late deliveries than a traffic jam.

“Human drivers know better than algorithms.” Experienced drivers know their routes better than any algorithm. But human drivers cannot manually optimize routes for 150 stops while driving. The best results come from algorithms that plan the outline and drivers who apply local knowledge to adjust it.

“Adding more stops makes routing more efficient.” The opposite. Adding stops makes routing exponentially harder. A 50-stop route is manageable. A 150-stop route with time windows and weight constraints is computationally intensive. Dense urban delivery works because stop clusters are small, not because the routing problem is easy.

Key terms

TSP (Traveling Salesman Problem): The mathematical problem of finding the shortest route through a set of stops. The TSP is NP-hard, meaning exact solutions for large sets are computationally infeasible.

VRP (Vehicle Routing Problem): The TSP extended with real-world constraints: vehicle capacity, time windows, multiple depots, and driver schedules. All modern delivery routing solves a variant of VRP.

OR-Tools: Google’s open-source optimization library that provides solvers for vehicle routing, scheduling, and related problems. Used by Amazon, UPS, and others as a foundation for commercial routing systems.

Time window: A commitment to deliver within a specific time range, such as “by 12pm.” Routers must honor these windows as hard or soft constraints.

ORION: UPS’s proprietary routing system, one of the most sophisticated commercial routing applications in the world, handling hundreds of millions of packages annually.

Clarke and Wright savings algorithm: A method for merging delivery routes efficiently to reduce total distance. Produces near-optimal fleet-level routes in seconds.

Last-mile delivery: The final step in the supply chain, from the local depot to the recipient’s door. The most expensive segment per package.