SPC control charts: the X-bar and R chart, worked end to end.

Quality / SPC July 2, 2026 9 min read 1,900 words

A control chart answers one question in real time: has my process changed, or is this just normal variation? Get that right and you stop chasing noise and catch real shifts early. The workhorse for machined and measured parts is the X-bar and R chart — here are the formulas, a full worked example, and the rules that turn a chart into a decision.

What SPC is

Statistical Process Control separates two kinds of variation. Common-cause variation is the natural noise built into a stable process — you leave it alone. Special-cause variation is a signal that something changed: a tool wore, a new batch of material arrived, an operator adjusted a setting. The control chart is the tool that tells the two apart, so you act only when action is warranted.

The classic mistake it prevents is tampering — adjusting a machine after a single part drifts, which usually adds variation rather than removing it. On the shop floor I have watched a good process turned unstable by well-meaning over-correction. A control chart draws a clear line: inside the limits with no pattern, hands off; a signal, investigate.

The X-bar and R chart formulas

You collect data in small subgroups — typically 4 or 5 consecutive parts — taken at regular intervals. For each subgroup you compute the average (X-bar) and the range (R = max − min). Then:

ChartCentre lineControl limits
R chartR-bar (mean of ranges)UCL = D4 × R-bar,  LCL = D3 × R-bar
X-bar chartX-double-bar (grand average)X-double-bar ± A2 × R-bar

The constants A2, D3 and D4 depend only on the subgroup size n. Read the R chart first: if the spread is unstable, the X-bar limits (which are built from R-bar) are meaningless.

nA2D3D4
21.88003.267
31.02302.574
40.72902.282
50.57702.114

For n of 6 or less, D3 is 0, so the R chart has no lower control limit — a range of zero is allowed.

A worked example

Take a turning operation on a shaft diameter, target ⌀25.00 mm, sampled in subgroups of n = 5 every hour. After 20 subgroups you find the grand average and the average range:

  • Grand average, X-double-bar = 25.02 mm
  • Average range, R-bar = 0.06 mm

From the table at n = 5: A2 = 0.577, D3 = 0, D4 = 2.114. Compute the R chart first:

  • R chart UCL = D4 × R-bar = 2.114 × 0.06 = 0.127 mm
  • R chart LCL = D3 × R-bar = 0 × 0.06 = 0

With the spread in control, compute the X-bar chart:

  • UCL = 25.02 + (0.577 × 0.06) = 25.02 + 0.0346 = 25.055 mm
  • LCL = 25.02 − (0.577 × 0.06) = 25.02 − 0.0346 = 24.985 mm

So any subgroup average between 24.985 and 25.055 mm, with ranges under 0.127 mm and no pattern, is normal. A subgroup average of 25.07 mm is a special-cause signal — investigate the process, do not simply re-cut the part.

From control to capability A chart tells you the process is stable; capability tells you whether stable is good enough against the drawing. Once your X-bar and R chart is in control, feed the same data into the free Cp and Cpk calculator to see how the spread compares with the tolerance. Control first, capability second — capability on an unstable process is a fiction.

Control limits are not specification limits

This is the single most misunderstood point in SPC. Control limits come from the process data — they describe what the process actually does. Specification limits come from the drawing — they describe what the customer needs. They are unrelated, and you must never draw the spec limits on a control chart.

Never put spec limits on a control chart A process can sit comfortably inside its control limits and still be out of spec, or wander outside its control limits while every part is in spec. Mixing the two lines leads operators to adjust a stable process or ignore a real shift. Judge stability with control limits; judge conformance separately with the tolerance.

The Western Electric rules

A point outside three sigma is the obvious signal, but patterns inside the limits also reveal a shift. The classic Western Electric rules flag a special cause when:

  1. One point beyond a 3-sigma control limit.
  2. Two of three consecutive points beyond 2 sigma on the same side.
  3. Four of five consecutive points beyond 1 sigma on the same side.
  4. Eight points in a row on one side of the centre line.

A run of eight points above the centre line, even with none outside the limits, means the process has drifted — a slowly wearing tool is the textbook cause. Catching that trend before it breaches the limit is exactly what SPC is for.

Which control chart to use

Data typeChartUse when
Variable, subgroups of 2–9X-bar & RMeasured dimensions, standard shop case
Variable, subgroups of 10+X-bar & sLarger subgroups; s estimates spread better
Variable, single readingsI-MRSlow or costly measurement, one part at a time
Attribute, defectivesp or npPass/fail counts of nonconforming units
Attribute, defectsc or uCounts of defects per unit or per area

For most machined-part work with a caliper or micrometer, X-bar and R is the right default. Switch to I-MR when you can only measure one piece at a time, such as a slow CMM check.

Common mistakes

  • Drawing spec limits on the chart. The most common error — keep tolerance and control limits on separate pages.
  • Reading the X-bar chart before the R chart. X-bar limits are built from R-bar; an unstable range makes them invalid.
  • Too few subgroups. Use 20–25 subgroups for trial limits; fewer and the limits are unreliable.
  • Recalculating limits on every point. Fix the limits from a stable baseline and recompute only after a proven change.
  • Ignoring in-limit patterns. A run or trend inside the limits is still a signal — apply the Western Electric rules.
  • Subgroups that hide variation. Sample consecutive parts so within-subgroup range reflects short-term noise, not shift-to-shift drift.

Where control charts fit with your other quality data

SPC is the stability layer under everything else. Pair it with Cp and Cpk for capability, Gauge R&R to trust the measurements feeding the chart, and DPMO and sigma level to translate performance into a defect rate. The dimensional data behind your charts is only as clean as the inspection that produced it — CadNexa's auto-ballooning tool numbers every characteristic on the drawing so each reading maps to a defined feature. Blank charting forms are on the templates page.

RR
Rajadurai R
Founder, MetricMech · 14 years plant-head experience