Mass-Spring Oscillator Calculator (SHM) — Period, Frequency & Energy

Calculate or solve backward for the period of oscillation, natural frequency, angular frequency, mass, spring constant, restoring force, peak speed, peak acceleration, amplitude, and energy of an ideal mass-spring system in simple harmonic motion. Values stay in your browser.

Solve the mass-spring system

Enter spring constant and mass to find the period.

Amplitude is always non-negative. Signed position x appears only when force is evaluated at a particular position.

Period T
0.628319 s

The mass completes one ideal oscillation every 0.628319 seconds.

Step-by-step solution
  1. Formula: T = 2π√(m/k)
  2. Substitute: T = 2π√(1 kg ÷ 100 N/m)
  3. Intermediate: ω = √(100 N/m ÷ 1 kg) = 10 rad/s
  4. Answer: T = 2π ÷ 10 rad/s = 0.628319 s

The mass completes one ideal oscillation every 0.628319 seconds.

Related system values
Natural frequency1.59155 Hz
Angular frequency10 rad/s

Advertisement

Motion and energy visualization

Reference motion: k = 100 N/m, m = 1 kg, A = 0.05 m. The marker begins at +A.

Open diagram, curves, and accessible data
0 s
Horizontal mass and spring at the selected timeA spring fixed to a wall moves a mass between negative and positive amplitude around equilibrium. m equilibrium−A+A

Interactive chart loading. The numeric calculator remains available if the chart library does not load.

Accessible values at key phases of one oscillation
PhaseTimePositionVelocityAccelerationPotential energyKinetic energy
00 s0.05 m0 m/s−5 m/s²0.125 J0 J
T/40.15708 s0 m−0.5 m/s0 m/s²0 J0.125 J
T/20.314159 s−0.05 m0 m/s5 m/s²0.125 J0 J
3T/40.471239 s0 m0.5 m/s0 m/s²0 J0.125 J
T0.628319 s0.05 m0 m/s−5 m/s²0.125 J0 J

Mass-spring formula reference

For displacement measured from equilibrium, Newton’s second law and Hooke’s law give m d²x/dt² = −kx. Moving every term to the left produces the ideal oscillator equation:

m · d²x/dt² + kx = 0

Its undamped solution is x(t) = A cos(ωt + φ). Differentiating gives velocity and acceleration; the spring and mass continually exchange potential and kinetic energy.

QuantityFormulaMeaning / SI dimension
Restoring forceF = −kxF in N = kg·m·s⁻². The minus sign points force toward equilibrium.
Angular frequencyω = √(k/m)ω in rad/s; dimension s⁻¹.
Natural frequencyf = ω/(2π)f in Hz = s⁻¹.
PeriodT = 2π√(m/k) = 1/fT in seconds.
Positionx(t) = A cos(ωt + φ)x and A in metres; φ is a dimensionless phase angle.
Velocityv(t) = −Aω sin(ωt + φ)v in m/s; vmax = Aω.
Accelerationa(t) = −Aω² cos(ωt + φ) = −ω²xa in m/s²; amax = Aω².
Total energyE = ½kA²E in J = kg·m²·s⁻².
Potential / kinetic energyU = ½kx²; K = E − U = ½mv²Both in joules.
Rearrange for massm = kT²/(4π²) = k/(2πf)²m in kg.
Rearrange for stiffnessk = 4π²m/T² = m(2πf)²k in N/m = kg·s⁻².

Symbols: k is spring stiffness, m is oscillating mass, x is signed instantaneous position from equilibrium, A is non-negative amplitude, t is time, T is period, f is frequency, ω is angular frequency, φ is initial phase, F is force, E is total energy, U is spring potential energy, and K is kinetic energy.

Worked mass-spring problems

1. Find period from mass and stiffness

Given: m = 2 kg, k = 200 N/m.

Work: T = 2π√(2/200) = 0.6283 s.

Meaning: the system completes about 1.59 cycles each second.

2. Find k from a measured period

Given: m = 0.5 kg, T = 0.8 s.

Work: k = 4π²m/T² = 30.8425 N/m.

Meaning: that stiffness produces the observed period for the attached mass.

3. Find peak speed and energy

Given: m = 0.8 kg, k = 50 N/m, A = 0.12 m.

Work: ω = √(50/0.8) = 7.9057 rad/s; vmax = Aω = 0.9487 m/s; E = ½(50)(0.12)² = 0.36 J.

Meaning: speed peaks at equilibrium while potential energy becomes kinetic energy.

4. Vertical spring equilibrium shift

Given: m = 2 kg, k = 100 N/m, g = 9.81 m/s².

Work: equilibrium shift = mg/k = 0.1962 m; T = 2π√(2/100) = 0.8886 s.

Meaning: gravity lowers equilibrium but does not change the ideal period measured about it.

How to interpret the ideal model

How mass changes period

T scales with √m. Multiplying mass by four doubles the period and halves the natural frequency when stiffness stays fixed.

How stiffness changes frequency

f scales with √k. A spring four times as stiff oscillates twice as fast with the same mass.

Why amplitude does not change period

In the linear ideal model, T depends only on m and k. Large amplitudes can expose spring nonlinearities, so real periods may change.

Horizontal versus vertical springs

A vertical spring stretches by mg/k before oscillation. Measure x from that shifted equilibrium and the same SHM equations apply.

Common mistakes

Do not mix grams with kilograms or centimetres with metres, confuse signed position with amplitude, or omit the 2π when converting between f and ω.

When the ideal model fails

Damping, spring mass, friction, coil binding, material yielding, large geometric motion, and changing stiffness require a more detailed model.

Frequently asked questions

What is the difference between period and frequency?

Period T is the time for one complete oscillation. Frequency f is the number of oscillations per second, so f = 1/T and T = 1/f.

Why does amplitude not change the ideal spring period?

For an ideal linear spring, both restoring force and acceleration scale with displacement, leaving T = 2π√(m/k) independent of amplitude. Real springs can depart from this behavior at large extensions.

What does the minus sign in Hooke’s law mean?

In F = −kx, the minus sign says the spring force points opposite to the signed displacement. It is a restoring force directed toward equilibrium.

Does a vertical spring have the same period as a horizontal spring?

Yes, in the ideal model. Gravity shifts the vertical spring’s equilibrium by mg/k, but oscillations measured from that new equilibrium still have T = 2π√(m/k).

Does the spring’s own mass affect the period?

Yes. If the spring mass is not negligible, a common approximation for a uniform spring fixed at one end is to use an effective oscillating mass m_eff = m_load + m_spring/3.

How does damping affect the motion?

Damping makes amplitude decrease with time and changes the damped frequency slightly. This calculator uses the undamped ideal model and does not estimate a damping ratio or decay time.

What is effective mass?

Effective mass is the inertia assigned to a simplified one-mass model. It may include the attached load plus participating portions of springs, supports, or other moving components.

Which units can I use?

You can use kg, g, or lb for mass; m, cm, mm, or in for position and amplitude; N/m, N/cm, or lbf/in for stiffness; s or ms for time; and Hz or rpm for frequency. The calculator converts values to SI internally.

When does Hooke’s law stop being accurate?

Hooke’s law is accurate only over a spring’s linear elastic range. Large deflection, coil contact, material yielding, friction, damping, or geometric nonlinearity can make force no longer proportional to displacement.

Methodology, precision, and review

Calculation author: Starlight Robotics. Editorial review: Starlight Tools Editorial Team. Last reviewed: 16 July 2026. An independent named physics or engineering reviewer is not currently listed.

The solver converts input to SI, applies the ideal undamped linear-spring equations above, then converts the answer back to the selected unit. Display precision is user-selectable from three to eight significant figures; scientific notation is used for very small or large values. Unrounded values are used internally.

Assumptions: one-dimensional motion, a massless spring, constant positive stiffness, negligible friction and damping, and motion inside the linear elastic range. This is educational software, not a safety-critical mechanical design tool.

Reference: OpenStax, University Physics Volume 1, §15.1 Simple Harmonic Motion and §15.2 Energy in Simple Harmonic Motion. Report a calculation error.

Explore more tools