Written and maintained by CASRAI Editorial Board
Last updated
An SPC chart (statistical process control chart, also called a Shewhart control chart) plots a process measurement over time against a centre line and control limits calculated from the data itself. This guide gives what most overviews leave out: the formulas, the full A2, D3 and D4 constants table for subgroup sizes 2 to 10, two worked examples with rounding shown, and code to compute the limits yourself. For choosing which chart suits your data, see choosing a control chart.
What is an SPC chart?
An SPC chart shows a measured quantity in time order with a centre line (the average) and an upper and lower control limit. NIST’s e-Handbook defines the limits as the plotted statistic’s mean plus or minus k standard deviations, and states that when k is set to 3 these are called 3-sigma control charts; it adds that k = 3 has become an accepted standard in industry (NIST/SEMATECH e-Handbook, section 6.3.2, checked 2026-10-29). In a laboratory the plotted quantity might be a control-sample reading, a calibration check or an instrument output, recorded in the order it was produced.
Which SPC chart fits which data?
NHS Scotland’s Quality Improvement Zone lists the main chart types by the kind of data plotted (NHS Scotland Turas QI Zone, SPC charts, checked 2026-10-29):
- XmR (I chart): individual measurements, described there as a good starting point.
- P chart: proportions.
- C chart: counts.
- U chart: rates.
- X-bar and S: grouped measurement data.
The same page notes that an XmR chart needs at least 20 data points and that fewer points call for a run chart instead, because SPC charts require enough data to calculate reliable control limits. The run chart rules guide covers that fallback. The constants and formulas below cover the X-bar and R chart for grouped measurements, and the c chart for counts.
What are the X-bar and R chart formulas?
With subgroups of n measurements, compute each subgroup’s mean and range (largest minus smallest value). Then take the grand mean of the subgroup means (x̿) and the average range (R̄). NIST gives these limits (NIST/SEMATECH e-Handbook, section 6.3.2.1, checked 2026-10-29):
| Chart | Upper control limit | Centre line | Lower control limit |
|---|---|---|---|
| X-bar | x̿ + A2·R̄ | x̿ | x̿ − A2·R̄ |
| R | D4·R̄ | R̄ | D3·R̄ |
The constants depend only on the subgroup size n. NIST derives them as A2 = 3 / (d2√n), D3 = 1 − 3d3/d2 and D4 = 1 + 3d3/d2, where d2 and d3 are tabulated factors that depend only on n. The range approach is, in NIST’s words, “quite satisfactory for sample sizes up to around 10”; beyond that, subgroup standard deviations are preferable, which is why the table stops at 10.
Constants table for X-bar and R charts (n = 2 to 10)
| Subgroup size n | A2 | D3 | D4 |
|---|---|---|---|
| 2 | 1.880 | 0 | 3.267 |
| 3 | 1.023 | 0 | 2.575 |
| 4 | 0.729 | 0 | 2.282 |
| 5 | 0.577 | 0 | 2.115 |
| 6 | 0.483 | 0 | 2.004 |
| 7 | 0.419 | 0.076 | 1.924 |
| 8 | 0.373 | 0.136 | 1.864 |
| 9 | 0.337 | 0.184 | 1.816 |
| 10 | 0.308 | 0.223 | 1.777 |
Source: NIST/SEMATECH e-Handbook of Statistical Methods, section 6.3.2.1, values as published to three decimals, checked 2026-10-29. Because D3 is 0 for n of 6 or fewer, an R chart with such subgroups has a lower limit of zero, which a range cannot go below.
Worked example 1: X-bar and R limits with n = 5
These readings are an illustrative composite, not real data: six consecutive subgroups of five replicate readings of a control sample, in arbitrary units.
| Subgroup | Readings | Mean | Range |
|---|---|---|---|
| 1 | 10.2, 10.4, 9.9, 10.1, 10.3 | 10.18 | 0.5 |
| 2 | 10.0, 10.3, 10.2, 9.8, 10.1 | 10.08 | 0.5 |
| 3 | 10.5, 10.1, 10.0, 10.2, 10.4 | 10.24 | 0.5 |
| 4 | 9.9, 10.2, 10.3, 10.0, 10.1 | 10.10 | 0.4 |
| 5 | 10.1, 10.4, 10.2, 10.3, 9.8 | 10.16 | 0.6 |
| 6 | 10.3, 10.0, 10.1, 10.5, 10.2 | 10.22 | 0.5 |
- Grand mean x̿ = (10.18 + 10.08 + 10.24 + 10.10 + 10.16 + 10.22) / 6 = 60.98 / 6 = 10.163.
- Average range R̄ = (0.5 + 0.5 + 0.5 + 0.4 + 0.6 + 0.5) / 6 = 0.500.
- For n = 5: A2 = 0.577, D3 = 0, D4 = 2.115.
- X-bar chart: UCL = 10.163 + 0.577 × 0.500 = 10.452; LCL = 10.163 − 0.289 = 9.875.
- R chart: UCL = 2.115 × 0.500 = 1.058; LCL = 0 × 0.500 = 0.
All six subgroup means fall between 9.875 and 10.452 and all ranges fall below 1.058. Six subgroups are used only to keep the arithmetic readable; as noted above, NHS Scotland’s guidance stresses having enough data for reliable limits (its XmR minimum is 20 points).
Worked example 2: a c chart for counts
For counts of events per equal-sized unit, NIST gives UCL = c̄ + k√c̄, centre line = c̄ and LCL = c̄ − k√c̄, with k usually set to 3 (NIST/SEMATECH e-Handbook, section 6.3.3.1, checked 2026-10-29). If the lower limit comes out negative, there is no lower control limit.
- Average count 16 per unit: √16 = 4, so UCL = 16 + 3 × 4 = 28 and LCL = 16 − 12 = 4.
- Average count 4 per unit: √4 = 2, so UCL = 4 + 3 × 2 = 10 and LCL = 4 − 6 = −2. The LCL is negative, so the chart has an upper limit only.
How do I compute control limits in Excel, R or Python?
Each snippet takes the grand mean and average range from example 1 and the n = 5 constants from the table.
Excel
' B1 = grand mean, B2 = average range
' A2 = 0.577, D3 = 0, D4 = 2.115 (n = 5)
X-bar UCL: =B1 + 0.577*B2
X-bar LCL: =B1 - 0.577*B2
R UCL: =2.115*B2
R LCL: =0*B2
c chart UCL: =C1 + 3*SQRT(C1)
c chart LCL: =MAX(0, C1 - 3*SQRT(C1)) ' 0 here stands for "no lower limit"
R
xbarbar = 10.163; rbar = 0.500
A2 = 0.577; D3 = 0; D4 = 2.115
c(LCL = xbarbar - A2 * rbar, UCL = xbarbar + A2 * rbar)
c(LCL = D3 * rbar, UCL = D4 * rbar)
Python
xbarbar, rbar = 10.163, 0.500
A2, D3, D4 = 0.577, 0.0, 2.115
print(round(xbarbar - A2*rbar, 3), round(xbarbar + A2*rbar, 3))
print(round(D3*rbar, 3), round(D4*rbar, 3))
How much data do I need, and when do limits change?
NHS Scotland’s guidance is that mean and limits should be frozen or extended from a baseline only if that baseline shows no special cause, and recalculated only when a sustained change has occurred. In practice, calculate limits from a stable baseline period, then keep plotting new points against those fixed limits rather than recomputing after every point. For monitoring a validated process over its lifecycle, see continued process verification, and for reviewing results that drift without breaching a limit, the out-of-trend investigation guide.
Frequently asked questions
What does SPC stand for?
Statistical process control: the use of control charts to monitor whether a process is behaving consistently over time.
Why are control limits usually set at 3 sigma?
NIST states that k = 3 has become an accepted standard in industry for Shewhart charts, and that many practitioners use k = 3 for count charts as well.
Can I use these constants for subgroups larger than 10?
The table here stops at n = 10 because NIST describes the range approach as quite satisfactory up to around 10; for larger subgroups, charts based on subgroup standard deviations are preferable.
Why does my R chart have no lower limit?
For subgroup sizes of 6 or fewer, D3 is 0, so the lower limit is 0. Similarly, a c chart has no lower limit when c̄ − 3√c̄ is negative.
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods, section 6.3.2, Shewhart control charts: https://www.itl.nist.gov/div898/handbook/pmc/section3/pmc32.htm (checked 2026-10-29).
- NIST/SEMATECH e-Handbook, section 6.3.2.1, X-bar and R control charts: https://www.itl.nist.gov/div898/handbook/pmc/section3/pmc321.htm (checked 2026-10-29).
- NIST/SEMATECH e-Handbook, section 6.3.3.1, counts control charts: https://www.itl.nist.gov/div898/handbook/pmc/section3/pmc331.htm (checked 2026-10-29).
- NHS Scotland, Turas Quality Improvement Zone, SPC charts: https://learn.nes.nhs.scot/3702/quality-improvement-zone/qi-tools/spc-charts (checked 2026-10-29).







