🔬
🔬 Science & engineering

Traffic Density Calculator (vehicles per km, flow, spacing & headway)

Results update as you type.

Your numbers

Understanding the traffic density calculator — concept and principle

Traffic density is the number of vehicles on a stretch of road at one moment. Combined with the average speed, it gives the traffic flow, the spacing between vehicles and the time headway. This calculator is used in traffic engineering courses, road planning and for understanding why congestion forms.

Traffic density and flow45 cars on 1.5 km, 3 lanes…every 100 m in each lane30 veh/km× 80 km/h2,400 veh/hPer lane: 800 veh/h · headway 4.5 s
Flow = density × speed: 30 vehicles per km at 80 km/h pass at 2,400 per hour.

How it is calculated

Density k = N ÷ L (vehicles per km)

Density per lane = k ÷ lanes

Flow q = k × v (vehicles per hour)

Average spacing = 1000 ÷ (density per lane) in metres

Average headway = 3600 ÷ (flow per lane) in seconds

The principle

The relation q = k × v is called the fundamental relation of traffic flow. Picture the vehicles as a moving column: if there are k vehicles in every kilometre and the column moves at v km/h, then k × v vehicles pass a fixed point each hour. Spacing is the inverse of density, and headway is the inverse of flow. Speed and density are linked as well: as density rises, drivers slow down. Flow therefore increases with density only up to a critical point (capacity); beyond it, speed falls faster than density rises, flow drops and congestion sets in.

Worked example

Default inputs: 45 vehicles on 1.5 km, 3 lanes, average speed 80 km/h.

  1. Density = 45 ÷ 1.5 = 30 vehicles/km.
  2. Per lane = 30 ÷ 3 = 10 veh/km/lane = 10 × 1.609 = 16.1 veh/mile/lane.
  3. Flow = 30 × 80 = 2,400 vehicles/h; per lane = 10 × 80 = 800 veh/h/lane.
  4. Spacing = 1000 ÷ 10 = 100 m.
  5. Headway = 3600 ÷ 800 = 4.5 s.
How Density (vehicles/km) changes with Length of the section (km)How Density changes with Length of the s…02550751001250.3750.751.121.51.882.253Example: 30Length of the section (km)
Each point is the calculator re-run with only “Length of the section (km)” changed; the gold point is the default example. Change the inputs above and this chart follows your numbers.
Length of the section (km)Density (vehicles/km)
0.375120
0.7560
1.1240
1.530
1.8824
2.2520
315

How to read the result

Low density with high speed means free-flowing traffic; drivers have room to change lanes. As density rises toward capacity, small disturbances like a sudden brake can grow into stop-and-go waves. Capacity guidelines put a freeway lane at roughly 2,000–2,400 passenger cars per hour under ideal conditions. A headway of 4.5 s is comfortable; headways under about 2 s mean vehicles are following closely.

Common mistakes

Keep in mind: The relation assumes steady, uninterrupted traffic. Real road design relies on local traffic counts and the relevant highway capacity guidelines.

Frequently asked questions

What is the difference between density and flow?

Density counts vehicles on a length of road at one instant; flow counts vehicles passing a point over time.

Why does traffic jam even without an accident?

Near capacity, small speed changes spread backward as waves that slow or stop following vehicles.

What is the two-second rule?

A safe-driving guideline to keep at least about two seconds of headway behind the vehicle ahead.

How do I measure density in practice?

Count vehicles on a known length from an aerial photo or camera, or estimate it from flow and speed.

Sources: MIT course 1.041/1.200 "Transportation: Foundations and Methods", lecture "Macroscopic traffic models"

Checked 9 Nov 2026. MIT course 1.041/1.200 “Transportation: Foundations and Methods”, lecture “Macroscopic traffic models” (C. Wu, Spring 2026): density k [veh/km], flow q [veh/h], space-mean speed, q = vs·k. Spacing = 1/k and headway = 1/q are the standard definitions.

🔬 All science & engineering tools →🌍 Calculators by country →