Hooke's law in one line
Within its elastic range, a spring pushes or pulls back with a force proportional to how far it has been moved from its resting length. Robert Hooke published this relationship in 1678, and it is the basis for spring scales, suspension springs, switches and countless other devices. This page applies it to a single ideal spring. You enter the spring rate and the displacement, with sign, and you get the restoring force in newtons. The sign matters: it tells you the force acts against the displacement, which is what makes a spring oscillate when released. Hooke first stated the idea as a Latin anagram in 1660 and gave its solution in 1678: the extension is proportional to the force. Textbooks restate it in the form used here, where the spring rate k, also called the spring constant or stiffness, collects the properties of the particular spring.
The formula and the sign convention
The restoring force is F = −k × x. The spring rate k is in newtons per meter, and x is the displacement from the rest position in meters. Choosing a direction as positive, a stretch has positive x and gives a negative force, which pulls back toward rest. A compression has negative x and gives a positive force, which pushes outward. OpenStax College Physics covers this in its section on elasticity, stress and strain. If you only want the size of the force, ignore the sign and use k times the absolute value of x.
A 100 N/m spring pulled 0.2 meters
The page opens with a spring rate of 100 N/m and a displacement of 0.2 m. The restoring force is −100 × 0.2 = −20 N. A force of 20 N is about the weight of a 2 kg mass, which sits near 19.6 N under standard gravity of 9.80665 m/s². So hanging 2 kg on this spring would stretch it a little more than 0.19 m, close to the default displacement. The energy stored at this displacement is ½ × k × x², which is ½ × 100 × 0.04 = 2 J.
Stiff and soft springs under compression
A stiff spring of 2,500 N/m compressed by 0.04 m (x = −0.04) returns a force of +100 N, pushing outward. A softer spring of 850 N/m stretched by 0.12 m gives −102 N. A spring rate often appears in N/mm on datasheets: 5 N/mm equals 5,000 N/m, so at an extension of 0.012 m the force is −60 N. Doubling the displacement doubles the force, and doubling the spring rate does the same. These linear scaling rules hold only while the spring stays in its elastic range. A useful consistency check is the ratio of force to displacement: for every example above it returns the spring rate, so 102 divided by 0.12 gives back 850. If the ratio of two measured pairs differs, the spring is not behaving linearly, or one of the measurements contains an error, usually a displacement taken from the wrong reference length.
Finding the spring rate
The rate can come from a datasheet, or you can measure it. Hang a known mass from the spring, measure how much it stretches, and divide the weight in newtons by the stretch in meters. A 2 kg mass weighs 19.613 N, so a stretch of 0.05 m gives k = 19.613 / 0.05, about 392.27 N/m. Use several masses and check that the points fall on a straight line. If the line curves, the spring leaves the linear range or has preload. The page does not infer the rate from the wire or coil geometry, so you must provide it. Measure displacement from the unloaded length, not from the length when installed. A spring that is already compressed by 0.03 m in its housing and is then pushed 0.02 m further is displaced by 0.05 m from rest, and that total is the value to enter if you want the full force.
Springs in combination
Springs can be combined to change the effective rate. Two springs side by side, both pushing on the same object, add their rates: 100 N/m plus 100 N/m gives 200 N/m. Two springs end to end, in series, give less than either one, following 1/k = 1/k1 + 1/k2, so two 100 N/m springs behave as 50 N/m. Entering 50 N/m with a displacement of 0.2 m returns −10 N, half the force of a single spring at the same total stretch. Knowing the effective rate lets you use this page for the whole assembly.
Preload and the linear range
Real springs depart from the ideal line. Many compression springs are wound or assembled with a preload, so the first part of the travel does not follow the straight line. Near full compression, the coils touch and the force rises sharply. If a spring is stretched too far it yields and does not return to its original length. The model on this page applies within the linear elastic range only. Manufacturers state the working range, the solid length and the maximum safe deflection, and these limits should be respected when choosing an entry for the displacement.
Using the force and the energy
The force lets you compare a spring with other loads. A 20 N restoring force can be balanced by a 20 N push, or by a 2.04 kg mass hanging at rest. The stored energy is ½ k x², which gives 2 J for the default. That energy sets how fast a released mass moves: a 0.5 kg mass released from this point would reach about 2.83 m/s at the rest position if no energy is lost. The spring oscillation period for mass m is 2 pi × sqrt(m / k), which for this spring and mass is about 0.44 s.
Linear springs within their elastic range
This is a scalar educational model of a linear spring within its elastic range, and the output must be a finite number. It does not check yield, fatigue, buckling of long compression springs, temperature effects or the mass of the spring itself. Do not use the result to rate a spring for a safety-critical application such as a brake, a vehicle component or a release mechanism. Use the manufacturer's data for the real part, and treat the page as a way to understand and check the ideal relationship. Springs also have a mass of their own, and in fast motion part of it moves, so the simple formula describes the static force more accurately than a rapidly moving system.