Linear Interpolation Calculator

Calculate an unknown x or y between two known points with inverse interpolation, formula steps, line details, and extrapolation warnings.

Calculation mode

Known data points

Enter the coordinates of the two points that define the straight line.

First point

Second point

How to Use the Linear Interpolation Calculator

Estimate a value between two known coordinates in three quick steps. The calculator also supports inverse interpolation when y is known.

1

Choose whether to find y from x or find x from y.

2

Enter the first known coordinate (x₁, y₁).

3

Enter the second known coordinate (x₂, y₂).

4

Add the known target value and select the display precision.

5

Review the result, position ratio, line equation, graph, and calculation steps.

What Is Linear Interpolation?

Linear interpolation estimates a value on the straight line connecting two known points. It assumes a constant rate of change across the selected interval.

NIST linear interpolation formula
  • Interpolation: the target lies between both endpoints.
  • Extrapolation: the target lies outside the known interval and carries more uncertainty.
NIST guidance on interpolation and extrapolation

Linear Interpolation Formula

Use the forward equation to find y, or the inverse equation to find x. The position factor t expresses the target as a percentage of the interval.

Find y from x

y = y₁ + ((x − x₁) / (x₂ − x₁)) × (y₂ − y₁)

Inverse interpolation

x = x₁ + ((y − y₁) / (y₂ − y₁)) × (x₂ − x₁)
01

Find the position ratio

Calculate t = (x − x₁) / (x₂ − x₁) to locate the target within the interval.

02

Scale the output interval

Multiply t by the difference between y₂ and y₁.

03

Add the first value

Add y₁ to obtain the interpolated result.

04

Check the target range

A t value below 0 or above 1 indicates extrapolation.

x₁, y₁
First point
x₂, y₂
Second point
t
Position factor
m
Line slope

Linear Interpolation Example

A sensor reads 10 units at x = 0 and 30 units at x = 100. Estimate the reading at x = 40.

Position ratio0.4
Scaled change0.4 × 20 = 8
Interpolated y18

Example Values Along the Line

Values follow the equation y = 0.2x + 10.

x valuePositionInterpolated y
00%10
2525%15
4040%18
7575%25
100100%30

Reliability

When linear interpolation is accurate

The method is exact when the underlying relationship is linear. For curved data it is an approximation, and using the nearest surrounding points usually reduces error.

SciPy interpolation guide

Pro tip

“For table data, use the nearest two rows that surround the target instead of distant points.”

Practical uses

Common linear interpolation applications

Two-point interpolation is commonly used to estimate values in lookup tables, measurements, spreadsheets, and systems with locally linear change. For a technical implementation reference, see MathWorks' one-dimensional data interpolation.

Engineering tables
Thermodynamic properties
Sensor calibration
Laboratory measurements
Finance and rate tables
Spreadsheet data
Time-series gaps
Graphics and LERP

Frequently Asked Questions

Essential answers about interpolation formulas, inverse calculations, and table values.

What is the linear interpolation formula?

For a known x, use y = y₁ + ((x − x₁) / (x₂ − x₁)) × (y₂ − y₁). It finds how far x lies between x₁ and x₂, then applies that same proportion to the y interval.

Can the endpoints be in descending order?

Yes. The formulas work when x or y decreases from the first point to the second. You do not need to reorder the points.

Does this calculator allow extrapolation?

Yes. If the target is outside the known interval, the calculator returns the straight-line extrapolation and displays a warning because uncertainty may be greater.

Why must x₁ and x₂ be different?

If x₁ equals x₂, the two points form a vertical line and y cannot be expressed as a unique function of x. In inverse mode, y₁ and y₂ must differ for the same reason.

What is inverse linear interpolation?

Inverse linear interpolation finds x for a known y. It applies the same position ratio to the x interval using x = x₁ + ((y − y₁) / (y₂ − y₁)) × (x₂ − x₁).

What does the position ratio mean?

The position ratio t shows how far the target lies from the first point toward the second. For example, t = 0.4 means the target is 40% of the way between the endpoints.

Is LERP the same as linear interpolation?

Yes. LERP is a common abbreviation for linear interpolation, especially in software development, computer graphics, games, and animation.

How do I interpolate between values in a table?

Choose the two adjacent table rows that surround the target, use them as the first and second known points, and enter the target value. Avoid using distant rows when closer surrounding values are available.

Related Calculators