Skip to main content

Interquartile Range Calculator

This interquartile range calculator finds Q1, median, Q3 and IQR from your data. Choose the quartile definition and check outlier fences without deleting values.

Find the spread of the middle half of your data

The interquartile range is the upper quartile minus the lower quartile. It measures the width of the middle half of a dataset in its original measurement unit. Sorting observations identifies the median and quartile positions. Duplicates and flagged outliers remain part of that dataset. Paste at least four numbers and choose the quartile definition required by your class, textbook or software. The default finds medians of the lower and upper halves, excluding the overall median when the observation count is odd. The tool also supports halves that include that median, and two separate interpolated definitions. Quartiles are not uniquely defined for every finite sample. A different accepted definition can change Q1, Q3, IQR and the resulting outlier flags. The method label stays visible with the answer so those differences can be traced rather than treated as an arithmetic error.

Match the quartile method

Including the median in the halves is different from Excel QUARTILE.INC interpolation.

Retain all observations

Outlier flags identify possible unusual values. The calculator does not remove them.

Check the common unit

Quartiles, IQR and fences retain the unit of the observations. No mixed-unit conversion is applied.

Check quartiles, IQR and outlier fences

The classroom preset uses 4, 7, 7, 3, 5, 2, 6, 7, 9. Under Median of halves (exclude center), Q1 is 3.5, median is 6, and Q3 is 7. IQR = Q3 - Q1 gives 3.5.

Inner fences are Q1 minus 1.5 times IQR and Q3 plus 1.5 times IQR. This preset’s fences are -1.75 and 12.25. Its flagged observations are none. Values exactly on a fence are not outside it. The NIST Box Plot reference supplies the quartile, IQR and inner-fence definitions.

The outlier preset uses 10 12 13 14 15 16 17 18 100. Its IQR is 5, with fences 5 and 25. The flagged observation is 100. That value remains in the sorted data used for the calculation. A statistical flag does not establish a data-entry error or justify deletion.

Match the quartile definition you need

The two median-halves options use the ordinary median of each sorted half. For an odd count, the exclusive halves omit the overall median, while the inclusive halves include it in both halves. For an even count, those two partition conventions agree. These are explicitly named classroom conventions, without an inferred match to a particular calculator device.

Interpolated quartiles use a one-based position between sorted observations. R type7 uses the probability to scale the observation count minus one, then adds the first position. R type6 scales the observation count plus one by that probability. Q1 and Q3 use probabilities 0.25 and 0.75. Adjacent observations are linearly interpolated at the resulting positions. R’s quantile documentation states both definitions.

The comparison dataset 1 2 3 4 5 6 7 8 gives these results:

Median of halves (exclude center): Q1 2.5, Q3 6.5, IQR 4.

Median of halves (include center): Q1 2.5, Q3 6.5, IQR 4.

Interpolated quartiles (R type 7 / Excel INC): Q1 2.75, Q3 6.25, IQR 3.5.

Interpolated quartiles (R type 6 / Excel EXC): Q1 2.25, Q3 6.75, IQR 4.5.

Type7 matches the interpolation convention used for Excel QUARTILE.INC; type6 matches QUARTILE.EXC for the supported quartile positions. At least four observations keeps the lower and upper type6 positions inside the data. Do not confuse the word inclusive in Excel’s function name with including the overall median in each half.

Interpret outliers and input limits

Flags use strict comparisons with the unrounded inner fences. The boundary check -3 0 0 1 2 2 5 has fences -3 and 5 and no flagged observations. Its endpoint values lie exactly on the fences. The constant check 2 2 2 2 has IQR 0 and no flagged observations; zero IQR is a valid result.

Large baselines can conceal small quartile differences after rounding. The precision check 10000000000000000 10000000000000002 10000000000000004 10000000000000006 under type7 retains IQR 3. Quartile positions and fences use exact rational arithmetic over the parsed input values. The working retains exact Q1, median, Q3, IQR and both fences. Numeric summary fields can be approximate; short absolute values that cannot be represented by those fields display precise terminating decimals. Longer inexact values refer explicitly to the exact working. Strict outlier comparisons use the rationals, without an epsilon allowance. Input precision already lost before calculation cannot be recovered.

For squared-deviation spread, use the Standard Deviation Calculator. For additive center and repeated values, the Mean Median Mode Calculator reports those quantities. The Mean Absolute Deviation Calculator distinguishes mean distance about the mean from unscaled median distance about the median. Those are different spread definitions, rather than alternate names for IQR.

Local limits are 5,000 observations, 100,000 characters and 128 characters per numeric token. Nonzero entered magnitudes range from 1e-100 to 1e+100. The first 100 sorted observations are shown in details, while all accepted observations contribute. Simple fractions, decimals and scientific notation are accepted; invalid entries are rejected rather than discarded.

Results display up to 10 significant digits for ordinary approximate formatting. Precise terminating-decimal displays can be longer when a numeric field cannot represent the exact result. Details include a numeric five-number summary, range and quartile working, rather than a boxplot image. The fences are a descriptive screening convention, without an inferred normal distribution, clinical reference range or automatic removal rule.

References

(6)