Linear Interpolation Calculator
Linear interpolation finds an unknown value that sits between two values you already know, by drawing a straight line between the two known data points and reading off the line at your target position. It is one of the most widely used techniques in science, engineering, and finance for filling gaps in tables of data, such as reading a value between two printed entries in a steam table, a tax bracket, or an actuarial table. Enter your two known points and the x value you want, and this calculator returns the interpolated result along with the slope of the connecting line and whether your target lies inside or outside the known interval.
Linear interpolation formula
slope = (y2 - y1) / (x2 - x1)
y = y1 + (x - x1) * slope
fraction = (x - x1) / (x2 - x1)
interpolation when 0 <= fraction <= 1, otherwise extrapolation
The slope is the rise over the run between the two known points. The interpolated y adds the slope times the horizontal distance from the first point to the target x. The fraction tells you how far along the interval the target sits: 0 at the first point, 1 at the second.
Where linear interpolation is used
- Reading intermediate values from thermodynamic, logarithm, or trigonometric tables.
- Estimating a tax or duty amount that falls between two published bracket boundaries.
- Resampling sensor or time-series data onto a regular grid.
- Computer graphics: blending colors, positions, or animation frames between keyframes.
- Quick first-pass estimates before fitting a more detailed model to curved data.
Linear interpolation: frequently asked questions
What is linear interpolation?
Linear interpolation estimates an unknown value that lies between two known data points by assuming the relationship between them is a straight line. Given points (x1, y1) and (x2, y2), the interpolated y at a target x is y1 plus the slope times the horizontal distance from x1.
What is the linear interpolation formula?
The formula is y = y1 + (x - x1) * (y2 - y1) / (x2 - x1). The fraction (y2 - y1) / (x2 - x1) is the slope of the line through the two points, and multiplying it by (x - x1) gives the rise over the run from the first point to the target x.
Can I interpolate outside the two known points?
When the target x lies outside the interval between x1 and x2, the calculation is technically extrapolation rather than interpolation. The same straight-line formula applies, but accuracy falls because you are projecting beyond the data you actually observed. This calculator computes the value either way and flags it for you.
What happens if the two x values are equal?
If x1 equals x2 the slope is undefined because you would divide by zero, so no single line passes through both points unless their y values also match. The calculator returns n/a in that case because interpolation has no unique answer when the two x coordinates coincide.
When is linear interpolation accurate?
Linear interpolation is most accurate when the underlying function is close to linear over the interval and the two known points are close together. For sharply curved data, methods such as Lagrange or spline interpolation that use more points generally produce smaller errors.
Official sources
- NIST Digital Library of Mathematical Functions: Interpolation (Chapter 3.3).
- National Institute of Standards and Technology: NIST home.
Reviewed by the CalculatorHub team, edited by James Graham, 17 June 2026. See our methodology.