Home / Science / Engineering / Transportation engineering / Traffic flow fundamentalsTool #683

Traffic flow calculator: Greenshields, Greenberg and Underwood models, capacity and fundamental diagrams

Paste speed and density (or flow) observations and fit the Greenshields, Greenberg and Underwood models: free-flow speed, jam density, capacity, the speed-density, flow-density and speed-flow diagrams, and an operating point with level of service from density limits you enter. For study and planning.

Keep it one tap away for everyday use.

Bookmark Traffic flow fundamentals?

Press Ctrl + D now. Your browser opens its own bookmark box, where you choose the name and folder.

  1. Data
  2. Fit models
  3. Diagrams
  4. LOS
Nothing is uploadedWorks offline once open

Traffic data

One observation per row, for example 5-minute counts from a loop detector: two columns as chosen above. Use per-lane values (or whole-road values throughout). Density from flow and speed is k = q / v, using the space-mean speed. Header rows are skipped. The example is made up. Up to 10,000 rows.

Models and capacity

Each model is fitted the textbook way: Greenshields by regressing speed on density, Greenberg speed on ln(density), Underwood ln(speed) on density. "R² fit" is for that regression; "R² speed" and RMSE compare predicted and observed speeds, so all three can be compared. Greenberg has no finite free-flow speed and Underwood no finite jam density.

Operating point and level of service

Upper density limit for each level of service, per lane. The values filled in are example values only, not from any manual: enter the limits from the highway capacity manual or guideline you work to, for your type of road. Above E is F.

For study and planning; check your local design manual and a qualified engineer before using numbers for a real road.

Download

What it does

Traffic on a road can be described by three numbers: flow q (vehicles per hour), density k (vehicles per kilometre or mile of lane) and space-mean speed v, tied together by q = k·v. The way speed falls as density rises is the key to capacity. This page fits three classic speed-density models to your observations:

  • Greenshields: speed falls in a straight line from the free-flow speed v_f to zero at the jam density k_j. Capacity is v_f·k_j/4, at half the jam density and half the free-flow speed.
  • Greenberg: v = v_m·ln(k_j/k). It fits congested traffic well, but speed grows without limit at very low density. Capacity is v_m·k_j/e at density k_j/e.
  • Underwood: v = v_f·e^(−k/k_m). It fits light traffic well, but speed never reaches zero. Capacity is v_f·k_m/e at density k_m.

You get each model’s free-flow speed, jam density, optimum density, speed at capacity and capacity, how well it fits, and the three fundamental diagrams (speed-density, flow-density and speed-flow). An operating point panel gives speed, flow, spacing and headway for a density, flow or speed, and a level of service letter from density limits you enter.

How to use it

  1. Choose the units and which two columns you have: density and speed, flow and speed, or density and flow. Paste the observations or press Open a file.
  2. Read the table. Compare R² speed and RMSE to judge the models; “R² fit” belongs to each model’s own straight-line regression.
  3. Pick the model for the diagrams, or enter your own Greenshields values.
  4. In the operating point panel, give a density, flow or speed. A flow below capacity can be carried in two ways, uncongested and congested, and both are shown.
  5. Enter the level-of-service limits from the manual you use. The numbers already there are made-up examples, not official limits.

Worked example

The made-up example has 14 per-lane observations from 8 to 105 veh/km. Greenshields fits best (R² speed 0.9908): free-flow speed 96.3 km/h, jam density 121.4 veh/km, and a capacity of 2,923 veh/h at 60.7 veh/km and 48.2 km/h. Greenberg gives 2,713 veh/h and Underwood 2,539 veh/h.

At the default density of 25 veh/km, Greenshields gives 76.5 km/h and 1,912 veh/h (65.4 % of capacity), uncongested, with vehicles 40 m apart and 1.88 s headway. With the made-up example limits (D up to 26 veh/km) that is level D; enter your manual’s limits to get a real answer. For a flow of 2,000 veh/h the two states are 26.6 veh/km at 75.2 km/h (uncongested) and 94.8 veh/km at 21.1 km/h (congested).

FAQ

Which speed should I use? The space-mean speed (the harmonic mean of spot speeds), because q = k·v only holds for it.

Why do the models disagree on capacity? They assume different shapes, and data rarely cover both light and heavy traffic evenly. Look at which model follows your points near the top of the flow-density curve.

Can I use this for design? It is for study and planning. Check your local design manual and a qualified engineer.

Is my data uploaded? No. Everything runs in your browser and works offline.

Where the numbers come from

  • Models and their regressions as given in transportation engineering textbooks: Greenshields (1935) linear speed-density, Greenberg (1959) logarithmic, Underwood (1961) exponential; q = k·v and the capacity of each model follow from the formulas (general traffic flow theory).
  • Checked against NumPy (numpy.polyfit for all three regressions and their R²), SciPy (scipy.optimize.brentq for the two densities that carry a given flow) and a hand-worked Greenshields example (v_f = 100 km/h, k_j = 120 veh/km gives 3000 veh/h at 60 veh/km).
  • The example observations and the level-of-service density limits are made up by fibub; they are not taken from any manual, agency or data set.

Standard scientific values, such as constants, atomic weights and melting points, are facts found in every textbook; we name where ours were checked. If you are an author or publisher and want a value, a credit or a table changed or removed, tell us and we will act quickly.

Last updated 2026-11-09.

Related tools

GPS track analyser #134 Open a GPX file or paste a CSV of time, latitude, longitude and elevation. Get the distance on the WGS84 ellipsoid, moving and stopped time, average and top speed, climbing with a noise threshold, splits per km or mile, a plan, an elevation profile and a speed chart. The file never leaves your device. Publication plot maker #27 Paste columns or open a CSV or Excel file and get a clean scientific figure with error bars, sized for a journal column. Download vector SVG or PDF, or PNG at 300 or 600 dpi. Your data stays in your browser. Signal timing (Webster's method) #684 Enter each approach's phase, flow and saturation flow to get the critical flow ratios, total lost time, Webster's optimum cycle C0 = (1.5L + 5)/(1 − Y), effective and displayed greens, capacity, degree of saturation and Webster delay for every approach, with a timing diagram and a delay-against-cycle curve. For study and planning. 1D Schrödinger solver #923 Choose a textbook potential, type a formula or draw your own, and get the lowest energy levels and wavefunctions of the one-dimensional Schrödinger equation by the matrix (finite-difference) method, with the exact levels alongside for the box, harmonic oscillator, finite well, Morse, linear and Pöschl–Teller potentials. Adduct and neutral loss calculator #984 Type a formula or a neutral monoisotopic mass and get the m/z of 25 common electrospray adducts in positive and negative mode, the ions left after common neutral losses (water, ammonia, CO2, sugars, phosphate and your own), and match a list of observed m/z values within a ppm tolerance. With no molecule, it turns observed m/z values into candidate neutral masses. Air quality calculator #116 Convert gas concentrations between ppm, ppb, µg/m³ and mg/m³ at any temperature and pressure, and work out the US Air Quality Index (with the 2024 PM2.5 breakpoints), India's National AQI and Canada's Air Quality Health Index from your own readings.