📘 Beginner Tips & Guide

Linearity Calculator Guide — Slope, Intercept, r & R² Explained

How the Linearity Calculator turns a standard weight, dilution factors and replicate readings into slope, intercept, r, R² and %Y-intercept, how pass or fail is decided, and what every setting and message means.

📐 Linearity Calculator 📘 Beginner Tips & Guide

How the Linearity Calculator Works, From Weight to Verdict

📐
What it does
You give it a standard weight and a set of levels, each with its own Dilution Factor and replicate readings. It turns every level into a concentration, averages the readings, fits a straight line through the level averages, and reports slope, intercept, r, R² and %Y-intercept, with a pass or fail based on r.
🧮
The concentration formula
Every level's concentration is the weight of the standard multiplied by that level's dilution factor.
Conc. (mg/mL) = Weight of Standard (mg) × Dilution Factor

The Four Steps on the Calculator Page

  1. Enter the weight of the standard and a Dilution Factor for each level.
  2. Label each level (80, 90, 100 and so on) and add the replicate readings.
  3. Click Calculate Linearity.
  4. Review r, R², the regression chart and the math log.

Every Setting, Explained

SettingWhat it does
Instrument TypeHPLC (Peak Area) or UV-Vis (Absorbance). The response label changes in the table, results, chart, math log, copy text and print report. UV-Vis also turns on an absorbance range check (see below).
Weight of Standard (mg)The weight taken to prepare the stock standard solution. It must be a valid number, zero or more.
Acceptance Limit (min. r)r ≥ 0.999 (Common Assay Spec), r ≥ 0.998, r ≥ 0.995 (Trace / Impurity Spec), or Custom Limit. It starts at 0.999. A custom limit must be above 0 and no more than 1.
Decimal Places (display only)2, 3 or 4 places, or Custom Places from 0 to 10. It starts at 3. It changes how slope, intercept and averages are shown, not how they are calculated.
System SuitabilityAn optional block of standard replicate injections, switched on by default. See its own section below.
Level (%)A label for the row. It is not used to calculate the concentration.
Dilution FactorThe number, typed for each level, that turns the weight in mg into that level's concentration in mg/mL. The placeholder shows an example of the size of number expected, 0.00835.
Reading columnsThree to start with. Each is labelled Peak Area 1, 2, 3 or Absorbance 1, 2, 3.

Right under the table a live line shows the number of levels, the number of reading columns, and the Target 100% Concentration, which is the weight multiplied by the dilution factor of the level labelled 100.

Slope, Intercept, r, R² and %Y-Intercept: What the Calculator Computes

The calculator fits a straight line by ordinary least squares. It does not fit the individual readings. It fits one point for each level: the concentration on the x axis and the average of that level's readings on the y axis. Levels are put in order of concentration first.

ResultFormula usedIn plain words
Slope (m)Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)²The response gained for each unit of concentration. The page labels it "Response per unit conc."
Y-Intercept (c)ȳ − m · x̄The response the line gives at zero concentration
Correlation Coefficient (r)Σ(x − x̄)(y − ȳ) ÷ √[ Σ(x − x̄)² × Σ(y − ȳ)² ]The strength of the straight-line fit
R²r × rr squared
%Y-Intercept(Intercept ÷ line response at the 100% level) × 100How big the intercept is compared with the response at 100%. Needs a level labelled 100

Here x is a level's concentration, y is its average response, x̄ and ȳ are the means over all levels, and n is the number of levels. In the math log the three sums appear as Sxx, Syy and Sxy, and slope = Sxy ÷ Sxx, intercept = ȳ − slope × x̄, r = Sxy ÷ √(Sxx × Syy).

Five Levels, Three Readings Each

HPLC, weight of standard 25.0 mg, acceptance limit r ≥ 0.999, 3 decimal places. The levels are 80, 90, 100, 110 and 120, with dilution factors 0.0032, 0.0036, 0.0040, 0.0044 and 0.0048.

LevelDilution FactorPeak Area 1, 2, 3AverageConc. (mg/mL)
80%0.0032799200, 800900, 799500799866.670.08000
90%0.0036906100, 907400, 906800906766.670.09000
100%0.00401001500, 1002800, 10019001002066.670.10000
110%0.00441107200, 1108500, 11076001107766.670.11000
120%0.00481203600, 1204900, 12037001204066.670.12000

For the 80% level, the concentration is 25.0 × 0.0032 = 0.08000 mg/mL, and its average is (799200 + 800900 + 799500) ÷ 3 = 799866.67. The math log then gives:

x̄ = 0.10000  |  ȳ = 1004106.667
Sxx = 1.0000e-3  |  Syy = 1.0192e+11  |  Sxy = 1.0094e+4
Slope = 1.0094e+4 ÷ 1.0000e-3 = 10094000.000
Intercept = 1004106.667 − (10094000.000 × 0.10000) = −5293.333
r = 0.99983  |  R² = 0.99967

The regression equation reads y = 10094000.000x − 5293.333. The line gives a response of 1004106.67 at the 100% level, so the %Y-Intercept is −5293.333 ÷ 1004106.67 × 100 = −0.53%. The result cards show r as 0.9998 and R² as 0.9997, because r and R² are always shown with at least four decimals. Since 0.99983 is at or above the limit of 0.9990, the banner reads Linearity Passed.

When one level goes wrong

Change the three 110% readings to 1077200, 1078500 and 1077600. That level now averages 1077766.67 instead of 1107766.67. Everything else stays the same, but r falls to 0.9974 and R² to 0.9948, below the 0.9990 limit, so the banner turns red and reads Linearity Failed. One bad level was enough to fail a set that had passed with room to spare.

How Pass and Fail Is Decided

  • Only r decides. The calculator checks whether the calculated r is greater than or equal to the acceptance limit you chose. If it is, the banner shows Linearity Passed in green. If not, it shows Linearity Failed in red.
  • The line under the banner shows r to five decimals and the limit to four, for example r = 0.99983 … (r ≥ 0.9990).
  • R², slope, intercept and %Y-Intercept are shown for your information. None of them has a pass or fail limit.
  • System Suitability has its own tick or cross for %RSD, and it does not change the linearity verdict.
  • An invalid custom limit, or an invalid custom decimal-places value, shows a message instead of a result.

The Optional System Suitability Block

  • It is on by default, and a tick box lets you include or skip it. When it is skipped, it is not required to calculate, and it is left out of the results, the math log (Step 0) and the printed report.
  • It starts with 5 reading rows. Add Reading adds one, labelled Add Injection for HPLC or Add Absorbance for UV-Vis. A row can be removed only while more than 2 remain.
  • While it is on, every reading row must be filled with a number. A blank row blocks the calculation, so fill it or remove it.
  • A live line shows Count, Mean, SD and %RSD as you type, and needs at least 2 readings to show SD and %RSD. SD divides by n − 1, and %RSD = SD ÷ mean × 100.
  • The %RSD acceptance limit offers ≤ 2.0% (Common Spec), ≤ 1.0% (Tight Spec) or a custom limit. It starts at 2.0%. A custom value that is zero or invalid falls back to 2.0%.
  • The result shows count, mean, SD and %RSD with a tick when %RSD is at or below the limit and a cross when it is above.

What Changes for UV-Vis Absorbance

The calculation is the same for both instruments. Only the labels change, along with one extra check. With UV-Vis selected, every absorbance you enter, in the System Suitability block and in the level cells, must be between 0.00 and 2.0 AU.

  • A reading outside that range is outlined in red as you type.
  • If you switch from HPLC to UV-Vis while large peak-area values are still in the table, those cells are flagged at once, with a message asking you to correct or clear them before you calculate.
  • Calculating with an out-of-range absorbance shows a message and no result.
  • Switching instrument keeps what you have already typed. If you had results on screen, they are recalculated.

Adding Levels and Reading Columns, and What Blocks a Calculation

  • Add Level adds a new row with the same number of reading cells as the others, and puts the cursor in its % Level box. Add Cell (all levels) adds one reading column to every row at once, like inserting a column in a spreadsheet.
  • The × on a row removes that level, but at least 2 levels must remain. The × on a column heading removes that reading column from every level, and at least 1 column must remain.
  • The table starts with 5 levels labelled 80, 90, 100, 110 and 120 with empty dilution factors, and 3 reading columns.
  • Every level must be complete. Each row needs a % Level label, a Dilution Factor and every reading cell filled. If anything is missing, the calculation is blocked, the empty cells are outlined in red, and a message tells you to fill them or remove that level or column. Rows are never skipped quietly.
  • You need a valid weight of standard, at least 2 valid levels, and levels that do not all share the same concentration. If they do, the calculator reports that it cannot fit a line and asks you to check the dilution factor values.

Clear Data puts everything back to the starting state: 5 default levels, 3 reading columns, 5 System Suitability rows with the block switched on, the weight emptied, the limit back to 0.999, decimals back to 3, the %RSD limit back to 2.0%, and the results and chart hidden. The instrument type is kept.

What Appears After You Calculate

  • Verdict banner with the r value and your limit.
  • Four result cards: Correlation Coefficient (r), R², Slope (m) and Y-Intercept (c). r and R² use at least four decimals. Slope and intercept use your Decimal Places setting.
  • Regression Summary: number of levels (n), mean concentration (x̄) to 5 decimals, mean response (ȳ), %Y-Intercept to 2 decimals, and the regression equation written as y = mx + c.
  • Level table with each level, its dilution factor, all its readings, the average (2 decimals) and the concentration (5 decimals), followed by a slope, intercept, r and R² table.
  • Regression chart: blue dots for the level averages and a green line for the fitted regression. The x axis is Concentration (mg/mL) and the y axis is the Average response.
  • Math log: Step 0 System Suitability (when on), Step 1 concentration of each level, Step 2 average response, Step 3 means and the sums Sxx, Syy and Sxy, Step 4 slope and intercept, Step 5 r and R².

When the results refresh

Nothing shows until you press Calculate Linearity for the first time. After that, changing the weight, the acceptance limit, the decimal places, the instrument type, the System Suitability switch or its limit refreshes the results straight away. Changing a reading, or adding or removing a level or column, updates only the live Average and Conc. cells. Press Calculate Linearity again after those edits so that r, R² and the chart match the table.

Copying and Printing the Result

Copy puts a short text on your clipboard, headed Linearity Analysis Profile with the instrument name, followed by r, R², slope, intercept, the regression equation and the %Y-Intercept, and ending with the line "Calculated via BestPharmaTools.com".

Print Report opens an editable A4 preview. It builds a raw data table (level, dilution factor, every reading, the average and the concentration), a System Suitability table with mean, SD and %RSD when that block is on, and a results table with slope, intercept, r, R², the equation and the verdict. A snapshot of the regression chart is included once you have calculated. If you open the report before calculating, the results table shows "Not yet calculated". The header (logo, company, product or API) and footer (signatures) are for you to fill in on the sheet. A switch lets that header field read either Product Name or API, and the Instrument Name is filled in from the HPLC or UV-Vis toggle.

For a logo, choose an image of 1 MB or less and no larger than 512 × 512 px. A larger file or image is rejected with a message.

Mistakes That Change the Result

Wrong weight or dilution factor
Every concentration comes from the weight and the level's dilution factor. A typo in either moves the x value of one level, or of all of them, and r changes with it. Check these first if r looks unexpectedly low.
The same dilution factor on every row
All levels then get the same concentration, so no line can be fitted and the calculator stops with a message. Each level needs its own factor.
No level labelled 100
The %Y-Intercept and the Target 100% Concentration are found from the level whose label is exactly 100. Without one, both show a dash. The rest of the calculation is not affected.
One bad replicate
The fit uses the average of each level. One outlier reading shifts that level's average and can bend the line enough to fail r, as the worked example shows. Look at the individual readings, not only the averages.
Only two levels
The calculator accepts a minimum of 2 levels, but a line through two points always fits perfectly, so r tells you nothing. Add as many levels as your protocol calls for.
Editing a reading and forgetting to recalculate
Changed readings do not refresh r, R² or the chart on their own. Press Calculate Linearity again.
Peak-area numbers left in a UV-Vis table
UV-Vis accepts absorbance only from 0.00 to 2.0. Clear or correct any large values after switching instrument.

Before You Press Calculate

  • Instrument type chosen, and weight of standard entered in mg.
  • A different Dilution Factor on every level.
  • A % Level label on every row, including a level labelled 100 if you want the %Y-Intercept.
  • Every reading cell filled, or the extra level or column removed.
  • The acceptance limit set to the minimum r from your method SOP.
  • System Suitability readings filled in, or the block switched off.
  • For UV-Vis, every absorbance between 0.00 and 2.0.

Linearity Calculator: Questions People Ask

How do I calculate linearity for an HPLC method with this calculator?

Enter the weight of the standard in mg, choose HPLC, then fill in one row per level. Each row needs a % Level label, a Dilution Factor and the replicate peak areas. The calculator works out each level's concentration as weight × dilution factor, averages the replicates, fits a straight line through the level averages, and reports slope, intercept, r, R² and %Y-intercept. Press Calculate Linearity to see the result.

How are slope and intercept calculated?

By ordinary least squares on the level averages. Slope = Sxy ÷ Sxx and Intercept = ȳ − slope × x̄, where x is the concentration of each level, y is its average response, and x̄ and ȳ are the means of all levels. Sxx is the sum of (x − x̄)², Sxy is the sum of (x − x̄)(y − ȳ), and Syy is the sum of (y − ȳ)².

What r value passes linearity in this calculator?

The pass mark is whatever acceptance limit you select, and the verdict is based on r alone. The drop-down offers r ≥ 0.999 (labelled Common Assay Spec), r ≥ 0.998, r ≥ 0.995 (labelled Trace / Impurity Spec), or a custom limit that you type, above 0 and up to 1. Use the minimum r given in your own method SOP.

What is the difference between r and R²?

R² is r multiplied by itself. Both come from the same regression and both are shown with at least four decimals. The calculator decides pass or fail from r only, so R² is shown for information.

What is %Y-Intercept and why does it sometimes show a dash?

%Y-Intercept is the intercept divided by the response the fitted line gives at the 100% level, multiplied by 100. To find the 100% level the calculator looks for a level whose % Level label is exactly 100. If none of your levels is labelled 100, there is nothing to compare against and the result shows a dash. The value is displayed for your information and has no pass or fail limit in this calculator.

How many levels and replicate readings can I use?

You need at least 2 valid levels to calculate, and the table will not let you remove a level when only 2 are left. You can add as many as your protocol needs with Add Level. Every level has the same number of reading columns, starting at 3. Add Cell adds one more reading column to all levels at once, and the table keeps at least 1 reading column.

Does the % Level I type affect the calculation?

No. It is a label only. The concentration of each level comes from the weight of the standard and the Dilution Factor you enter for that row. The label is used to name the level in the tables and to find the 100% level for the %Y-Intercept.

Why do I get the error that all levels compute to the same concentration?

It means every level ended up with the same concentration, so there is no spread along the x axis and no line can be fitted. Check the Dilution Factor values. Each level should have its own.

Do the results update when I change a reading?

Not automatically. After the first calculation, changes to the weight, acceptance limit, decimal places, instrument type, or the System Suitability switch or limit recalculate on their own. Typing a different reading, or adding or removing a level or column, only refreshes the live Average and Conc. cells. Press Calculate Linearity again to refresh r, R², slope and the chart.

What does the System Suitability block do?

It is optional. When it is switched on, you enter the standard's replicate injections and the calculator shows count, mean, SD and %RSD, with a tick or cross against your %RSD limit (2.0% by default). It does not change the linearity verdict, and it is left out of the results, the math log and the printed report when you switch it off.

Is my data stored or sent to a server?

The calculation, chart, copy text and print preview all run in your browser, and the calculator script does not send your entries to a server.

Educational use only. This guide explains how the Linearity Calculator on this site works. It is not a validated system and does not replace your SOPs or your own review. Please read the disclaimer for how to use this site.

Ready to calculate?
Back to the Linearity Calculator
Build your levels, add replicate readings in the Excel-style table, and get your slope, intercept, r and R² instantly.
Open Calculator