Mass–Spring Oscillation Calculator

JJ Ben-Joseph headshot JJ Ben-Joseph

Introduction: why mass-spring oscillation calculations matter

A mass-spring-oscillation calculator is useful when you want to predict how a single moving mass will behave before you build, tune, or test the hardware. It keeps the problem focused on the variables that matter most here: mass, spring stiffness, viscous damping, an initial displacement, and an optional sinusoidal drive.

Because this page combines a numerical simulation, energy bars, and a resonance mini-game, you can inspect the oscillator from several angles at once. The value panel tells you the derived frequency and period, while the canvas shows the motion itself. That combination makes it easier to catch unit mistakes, unrealistic damping values, or a drive frequency that sits far from the behavior you expected.

The sections below show how to enter SI inputs, how the equations behind the model work, how to read the output, and when the linear approximation is good enough to trust.

What this calculator helps you answer

This calculator answers a very specific question: given a mass on a linear spring with viscous damping, how fast will it oscillate, how quickly will the motion fade, and how does a chosen drive frequency compare with the system's natural frequency?

That makes it useful for lab demonstrations, prototype tuning, classroom examples, and any situation where you want to compare a baseline oscillator against a changed one. If two runs use the same mass but different stiffness or damping, the simulator makes the shift in resonance and decay obvious.

State the question in one sentence before you change a field. Examples include: “How does a stiffer spring move the resonance peak?” or “How much damping is enough to settle the motion quickly?” When the question and the inputs line up, the result is much easier to trust.

How to use this mass-spring oscillation calculator

Enter values in SI units, then press Play to animate the oscillator and refresh the results panel.

  1. Enter m (kg) for the moving mass.
  2. Enter k (N/m) for the spring stiffness.
  3. Enter c (N·s/m) for the viscous damping coefficient.
  4. Enter A (m) as the initial displacement from equilibrium.
  5. Enter F₀ (N) to set the drive strength; leave it at 0 for a free decay.
  6. Enter ω d (rad/s) for the drive frequency you want to compare against the natural frequency.
  7. Press Play to start the simulation and update the output.
  8. Watch the frequency, period, and energy bars, then pause or reset if you want to test a different case.

If you want to keep the scenario, use the CSV button to save the current run for later comparison.

Inputs: choosing mass, stiffness, damping, and drive values

The oscillator equations assume kilograms, newtons, seconds, and meters, so unit discipline matters.

Common inputs for this mass-spring oscillator include:

If a value is uncertain, try a low and a high estimate in separate runs. The input that changes the oscillation pattern the most is usually the one you need to verify first.

Formulas: how the mass-spring calculator computes motion

This calculator follows the standard single-degree-of-freedom mass-spring-damper model, and the canvas is driven by the same equations.

m ẍ + c ẋ + kx = F₀ sin(ωd t)

The first equation says inertia, damping, and spring force must balance the sinusoidal drive. The second line gives the two values the page reports most often: the natural frequency and the damping ratio. When c is zero, the ratio is zero and the run is a pure conservative oscillation; as c grows, the motion loses energy more quickly.

ω₀ = √(k/m), ζ = c / (2√(km))

The simulation also tracks kinetic energy, spring energy, and accumulated dissipation so you can see whether the motion is trading energy smoothly or bleeding it away cycle by cycle. That is why the output is useful even when the drive frequency is off resonance: it still shows the way the model is responding to the inputs you chose.

Worked example: a lightly damped 1 kg mass on a 20 N/m spring

A useful check is to leave the defaults in place and read the derived values from a simple free-decay case.

With those numbers, the natural frequency is √20 = 4.472 rad/s and the period is about 1.405 s. The damping ratio is 0.056, which places the system in a lightly damped regime. Because F₀ is zero, the mass begins displaced from equilibrium and then rings down as the energy bars trade kinetic and potential energy while the dissipation bar rises. The initial spring energy is 0.100 J.

If the animation does not resemble a decaying bounce, revisit the units before looking for a more exotic explanation. A wrong mass unit or a stiffness value copied with the wrong scale will move the natural frequency far more than a small numerical tweak.

Sensitivity table: how changing spring stiffness shifts resonance

This table changes only k while the other example values stay fixed at m=1 kg, c=0.5 N·s/m, A=0.1 m, F₀=0 N, and ωd=1 rad/s. It shows the derived natural frequency, which is the main quantity that moves when the spring gets softer or stiffer.

Scenario k (N/m) Other inputs fixed Natural frequency Interpretation
Softer spring (-20%) 16 m, c, A, F₀, ωd unchanged 4.000 rad/s The resonance point shifts lower, so the same drive frequency sits farther above the natural frequency.
Baseline 20 m, c, A, F₀, ωd unchanged 4.472 rad/s This is the reference run used in the worked example.
Stiffer spring (+20%) 24 m, c, A, F₀, ωd unchanged 4.899 rad/s The resonance point shifts higher, so the same drive frequency sits farther below the natural frequency.

Notice that the damping ratio also moves a little because it depends on the square root of k: it is about 0.063 for the softer spring and about 0.051 for the stiffer one. That subtle change is easy to miss on paper, but the animation makes it visible because the decay rate changes along with the frequency.

How to interpret the mass-spring oscillation result

Read the result panel together with the canvas, not in isolation. A higher ω₀ means a faster oscillation, while a higher ζ means the amplitude dies away more quickly. If ωd sits close to ω₀ and damping is small, the motion can become much larger than a casual glance at the inputs suggests.

Check three things each time: the frequency is in rad/s, the period matches 2π/ω₀, and the energy bars tell the same story as the motion on screen. If those checks agree with the behavior you intended, you can treat the run as a practical estimate for the linear oscillator shown here.

Use the CSV button when you want a record of the same scenario so you can compare it to another set of mass, stiffness, or damping values later. That makes it easier to spot which parameter actually moved the resonance curve.

Limitations and assumptions of the linear oscillator model

This page models a single mass, a linear spring, and viscous damping, so it is best for systems that stay close to that approximation.

If you need a result for safety, compliance, or a complex structure, treat this calculator as a trend finder and confirm the answer with a more detailed analysis. For quick design comparisons, though, it is a fast way to see how mass, stiffness, damping, and forcing interact in a classic oscillator.

Enter oscillator values and press Play.
The current displacement, velocity, and energies will appear here.

Resonance Tuner Mini-Game for a Driven Mass-Spring System

Use the mini-game to feel how a drive frequency approaching the natural frequency changes the amplitude. Keep the motion inside the highlighted band to fill the lock meter, then shift again when the target changes. It is a quick way to build intuition for why small changes in drive frequency can make a large difference near resonance.

Click or tap to tune resonance
Time: 60.0 s · Score: 0 · Streak: 0
Drive ω
0.00 rad/s
Fine tune
Δ 0.00
Target amplitude 0.00–0.00 m
Lock progress 0%
ωₙ 0.00 rad/s
Damping ζ 0.00

Click the overlay to begin, then steer the drive frequency with arrow keys or the buttons.

Keyboard: Left/Right adjust ω by ±0.2 rad/s, A/D adjust by ±0.05 rad/s, R resets to ωₙ. Hold the amplitude inside the glowing band long enough to score before the timer hits zero.