HomePhysics › Hooke's Law Calculator

Hooke's Law Calculator

Computes the restoring force of a linear spring and the elastic potential energy stored at a given displacement, plus the natural period and frequency of a mass on that spring when a mass is supplied.

When to use

You know a spring constant and how far the spring is stretched or compressed and need the force or stored energy, or the oscillation period of a spring–mass system.

Do not use when: The spring is loaded beyond its elastic (linear) limit, or you need gravitational energy (use potential-energy) or a pendulum's period (use pendulum).

Formula

force_n = spring_constant_n_m × |displacement_m|; U = ½ × spring_constant_n_m × displacement_m²; T = 2π × √(mass_kg / spring_constant_n_m); f = 1 / T

Ideal massless linear spring (Hooke's law holds only within the elastic limit); the period formula ignores damping and the spring's own mass.

Inputs

ParameterTypeUnitRequiredDescription
spring_constant_n_mnumberN/myesStiffness k in newtons per metre. Range: > 0
displacement_mnumbermyesExtension (positive) or compression (negative) from the natural length, in metres (1 cm = 0.01 m).
mass_kgnumberkgnoOptional mass on the spring; enables the oscillation period and frequency outputs. Range: > 0

Outputs

OutputTypeUnitDescription
force_nnumberNMagnitude of the restoring force |k × x|, directed back toward the natural length.
elastic_potential_energy_jnumberJU = ½ × k × x².
period_snumbersT = 2π√(m / k) (only when mass_kg is given).
frequency_hznumberHzf = 1 / T (only when mass_kg is given).

Example

k = 200 N/m stretched 5 cm with 0.5 kg: {"spring_constant_n_m":200,"displacement_m":0.05,"mass_kg":0.5}{"force_n":10,"elastic_potential_energy_j":0.25,"period_s":0.3142,"frequency_hz":3.1831}

k = 5000 N/m compressed 12 cm: {"spring_constant_n_m":5000,"displacement_m":-0.12}{"force_n":600,"elastic_potential_energy_j":36}

GET https://tttkmbb.com/api/v1/calculate/hookes-law?spring_constant_n_m=200&displacement_m=0.05&mass_kg=0.5

Machine access

Sources

FAQ

How do I find the spring constant?

Hang a known mass and measure the extension: k = m·g / x. For example 0.5 kg stretching a spring 2.45 cm gives k = 0.5 × 9.80665 / 0.0245 ≈ 200 N/m.

Does the sign of the displacement matter?

Only for direction; the force magnitude and the stored energy are the same for equal stretch or compression.

Related calculators