# Linear Interpolation Calculator

Calculate the interpolated value between two data points using linear interpolation (LERP). Shows slope, equation, and position along the interval.

## What this calculates

Estimate a value between two known data points using linear interpolation. Enter the two known points and the x-value you want to evaluate. For instance, if you know y = 10 at x = 1 and y = 30 at x = 5, the interpolated value at x = 3 is 20.

## Inputs

- **x₀ (First x value)** — The x-coordinate of the first known point.
- **y₀ (First y value)** — The y-coordinate of the first known point.
- **x₁ (Second x value)** — The x-coordinate of the second known point.
- **y₁ (Second y value)** — The y-coordinate of the second known point.
- **x (Interpolation point)** — The x-value where you want to find y.

## Outputs

- **Interpolated y value** — The estimated y-value at the given x.
- **Slope (m)** — The slope of the line between the two points.
- **Line Equation** — formatted as text — The linear equation connecting the two known points.
- **Fraction Along Interval** — formatted as text — How far x is between x0 and x1, as a percentage.

## Details

**The Linear Interpolation Formula**

Given two known points (x0, y0) and (x1, y1), the interpolated value at x is:

**y = y0 + (x - x0) x (y1 - y0) / (x1 - x0)**

This is sometimes written as LERP(t) = a + t(b - a), where t is the fraction of the way from point 0 to point 1.

**Step-by-step Example**

Known points: (2, 100) and (6, 300). Find y at x = 4.

1. Slope: (300 - 100) / (6 - 2) = 200 / 4 = 50
2. Interpolated y: 100 + (4 - 2) x 50 = 100 + 100 = 200
3. Fraction along interval: (4 - 2) / (6 - 2) = 0.5 (50%)

**When to Use Linear Interpolation**

- Estimating values between readings in a data table
- Computer graphics and animation (smoothly blending between positions)
- Engineering calculations between tabulated material properties
- Anywhere you need a quick estimate between two known values

**Limitations**

Linear interpolation assumes a straight line between points. If the underlying relationship is curved (exponential, logarithmic, etc.), the estimate will be less accurate. For curved data, consider polynomial or spline interpolation.

## Frequently Asked Questions

**Q: What is linear interpolation?**

A: Linear interpolation (often called LERP) estimates a value between two known data points by assuming a straight line connects them. The formula is y = y0 + (x - x0)(y1 - y0) / (x1 - x0). It is one of the simplest and most widely used interpolation methods.

**Q: Can I use this for extrapolation?**

A: Technically yes. If your x falls outside the range [x0, x1], the formula still works, but the result is an extrapolation rather than interpolation. Extrapolated values can be unreliable since you are extending the line beyond your known data.

**Q: What does the fraction along interval tell me?**

A: It shows how far your query point x is between x0 and x1 as a percentage. At 0% you are at the first point; at 100% you are at the second point; at 50% you are exactly halfway. Values outside 0-100% indicate extrapolation.

**Q: When is linear interpolation a bad choice?**

A: When the data follows a curve rather than a straight line. For example, exponential growth data will be under-estimated by linear interpolation. In those cases, polynomial interpolation, spline interpolation, or a curve-specific formula will give better results.

---

Source: https://vastcalc.com/calculators/math/linear-interpolation
Category: Math
Last updated: 2026-04-08
