This article includes a list of references, related reading or external links, but its sources remain unclear because it lacks inline citations. (July 2021) 
In the mathematical field of numerical analysis, spline interpolation is a form of interpolation where the interpolant is a special type of piecewise polynomial called a spline. That is, instead of fitting a single, highdegree polynomial to all of the values at once, spline interpolation fits lowdegree polynomials to small subsets of the values, for example, fitting nine cubic polynomials between each of the pairs of ten points, instead of fitting a single degreeten polynomial to all of them. Spline interpolation is often preferred over polynomial interpolation because the interpolation error can be made small even when using lowdegree polynomials for the spline.^{[1]} Spline interpolation also avoids the problem of Runge's phenomenon, in which oscillation can occur between points when interpolating using highdegree polynomials.
Introduction
Originally, spline was a term for elastic rulers that were bent to pass through a number of predefined points, or knots. These were used to make technical drawings for shipbuilding and construction by hand, as illustrated in the figure.
We wish to model similar kinds of curves using a set of mathematical equations, with one polynomial for each pair of knots and , where . So there will be polynomials and knots: The first polynomial starts at , and the last polynomial ends at .
The curvature of any curve is defined as
To make the spline take a shape that minimizes the bending (under the constraint of passing through all knots), we will define both and to be continuous everywhere, including at the knots. Thus the first and second derivatives of each successive polynomial must have identical values at the knots, which is to say that
This can only be achieved if polynomials of degree 3 or higher — cubic polynomials or higher — are used. The classical approach is to use polynomials of exactly degree 3 — cubic splines.
Algorithm to find the interpolating cubic spline
We wish to find each polynomial given the points through . To do this, we will consider just a single piece of the curve, , which will interpolate from to . This piece will have slopes and at its endpoints. Or, more precisely,
The full equation can be written in the symmetrical form

(1)
where

(2)

��
(3)

(4)
But what are and ? To derive these critical values, we must consider that
It then follows that

(5)

(6)
Setting t = 0 and t = 1 respectively in equations (5) and (6), one gets from (2) that indeed first derivatives q′(x_{1}) = k_{1} and q′(x_{2}) = k_{2}, and also second derivatives

(7)

(8)
If now (x_{i}, y_{i}), i = 0, 1, ..., n are n + 1 points, and

(9)
where i = 1, 2, ..., n, and are n thirddegree polynomials interpolating y in the interval x_{i−1} ≤ x ≤ x_{i} for i = 1, ..., n such that q′_{i} (x_{i}) = q′_{i+1}(x_{i}) for i = 1, ..., n − 1, then the n polynomials together define a differentiable function in the interval x_{0} ≤ x ≤ x_{n}, and

(10)

(11)
for i = 1, ..., n, where

(12)

(13)

(14)
If the sequence k_{0}, k_{1}, ..., k_{n} is such that, in addition, q′′_{i}(x_{i}) = q′′_{i+1}(x_{i}) holds for i = 1, ..., n − 1, then the resulting function will even have a continuous second derivative.
From (7), (8), (10) and (11) follows that this is the case if and only if

(15)
for i = 1, ..., n − 1. The relations (15) are n − 1 linear equations for the n + 1 values k_{0}, k_{1}, ..., k_{n}.
For the elastic rulers being the model for the spline interpolation, one has that to the left of the leftmost "knot" and to the right of the rightmost "knot" the ruler can move freely and will therefore take the form of a straight line with q′′ = 0. As q′′ should be a continuous function of x, "natural splines" in addition to the n − 1 linear equations (15) should have
i.e. that

(16)

(17)
Eventually, (15) together with (16) and (17) constitute n + 1 linear equations that uniquely define the n + 1 parameters k_{0}, k_{1}, ..., k_{n}.
There exist other end conditions, "clamped spline", which specifies the slope at the ends of the spline, and the popular "notaknot spline", which requires that the third derivative is also continuous at the x_{1} and x_{N−1} points. For the "notaknot" spline, the additional equations will read:
where .
Example
In case of three points the values for are found by solving the tridiagonal linear equation system
with
For the three points
one gets that
In the figure, the spline function consisting of the two cubic polynomials and given by (9) is displayed.
See also
 Cubic Hermite spline
 Centripetal Catmull–Rom spline
 Discrete spline interpolation
 Monotone cubic interpolation
 NURBS
 Multivariate interpolation
 Polynomial interpolation
 Smoothing spline
 Spline wavelet
 Thin plate spline
 Polyharmonic spline
Computer code
TinySpline: Open source Clibrary for splines which implements cubic spline interpolation
SciPy Spline Interpolation: a Python package that implements interpolation
Cubic Interpolation: Open source C#library for cubic spline interpolation
References
 ^ Hall, Charles A.; Meyer, Weston W. (1976). "Optimal Error Bounds for Cubic Spline Interpolation". Journal of Approximation Theory. 16 (2): 105–122. doi:10.1016/00219045(76)90040X.
 Schoenberg, Isaac J. (1946). "Contributions to the Problem of Approximation of Equidistant Data by Analytic Functions: Part A.—On the Problem of Smoothing or Graduation. A First Class of Analytic Approximation Formulae". Quarterly of Applied Mathematics. 4 (2): 45–99. doi:10.1090/qam/15914.
 Schoenberg, Isaac J. (1946). "Contributions to the Problem of Approximation of Equidistant Data by Analytic Functions: Part B.—On the Problem of Osculatory Interpolation. A Second Class of Analytic Approximation Formulae". Quarterly of Applied Mathematics. 4 (2): 112–141. doi:10.1090/qam/16705.
External links
 Cubic Spline Interpolation Online Calculation and Visualization Tool (with JavaScript source code)
 "Spline interpolation", Encyclopedia of Mathematics, EMS Press, 2001 [1994]
 Dynamic cubic splines with JSXGraph
 Lectures on the theory and practice of spline interpolation
 Paper which explains step by step how cubic spline interpolation is done, but only for equidistant knots.
 Numerical Recipes in C, Go to Chapter 3 Section 33
 A note on cubic splines
 Information about spline interpolation (including code in Fortran 77)