Mass-spring period calculator
Hang 2 kg on a spring of 50 N/m and find how long one complete bounce takes, in seconds. Enter the mass and the spring constant to get the period of an ideal mass-spring oscillator for exercises, lab preparation or early design estimates. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- M
- 2
- K
- 50
- Period
- 1.2566370614 s
This mass-spring period calculator returns the time required for one complete oscillation of an ideal mass attached to a linear spring. With mass in kilograms and stiffness in newtons per metre, the result is in seconds. The calculation is deterministic and runs without network access, random sampling, or hidden assumptions about amplitude. It is useful for classroom exercises, laboratory preparation, simulation checks, and engineering estimates when damping, spring mass, and nonlinear behavior can be neglected.
What the mass-spring period represents
The period is the time needed for a mass to leave a point in its motion, travel through the rest of the cycle, and return to that point with the same direction of motion. The variable m is the oscillating mass and k is the spring constant, also called stiffness. A larger mass increases the period because the system changes velocity more slowly, while a stiffer spring decreases the period because its restoring force is stronger for the same displacement.
When m is entered in kilograms and k in newtons per metre, the returned period is measured in seconds. The result does not depend on amplitude within the ideal Hooke's-law model, an important property of simple harmonic motion. A zero mass is accepted mathematically and returns a zero period, although a real apparatus always has some effective moving mass.
How to enter mass and spring constant correctly
Enter the moving mass as m and the spring stiffness as k. Both values must be finite numbers. Mass cannot be negative, because a negative inertial mass is outside the classical model used here.
The spring constant must be strictly positive. A negative k is also rejected because it would make the square root non-real and does not represent a stable ordinary spring in this model. For an SI result, convert grams to kilograms and values such as newtons per centimetre to newtons per metre before submitting them.
For example, 500 grams becomes 0.5 kilograms, while 2 newtons per centimetre becomes 200 newtons per metre. The calculator does not guess or convert units, so any consistent alternative unit system must be interpreted by the caller. Numeric strings are accepted when they contain a finite number, but labels, unit suffixes, infinity, and missing fields fail validation instead of producing a misleading answer.
Assumptions, applications, and limits
The equation models one effective point mass and one massless, perfectly linear spring moving without damping. It assumes the spring follows Hooke's law throughout the displacement range and that no friction, air resistance, forcing, geometric nonlinearity, or changing constraint modifies the motion. Those assumptions make the formula excellent for introductory physics, early design estimates, and checks against numerical simulations, but they also define its limits.
A real spring contributes some effective mass, damping causes amplitude to decay, and large extensions may move the material beyond its linear range. Multiple springs may need an equivalent stiffness before this calculator is used, and coupled masses require a normal-mode analysis rather than one scalar period. Within the intended model, the algorithm directly evaluates 2π times the square root of m divided by k.
There is no iteration, network access, date dependency, or randomness, so equal inputs produce equal outputs.
What you can do with it
Check physics homework
Verify the simple harmonic motion period from a known mass and spring constant.
Prepare a spring laboratory
Estimate cycle timing before measuring repeated oscillations with a stopwatch or sensor.
Test simulation output
Create deterministic reference periods for an ideal mass-spring model in software tests.
FAQ
Which units should I use?
Use kilograms for m and newtons per metre for k to receive the period in seconds. The calculator does not perform unit conversion.
Why is a zero spring constant rejected?
The formula divides by k. When k is zero there is no restoring spring force and no finite spring-controlled oscillation period.
Does amplitude change the period?
Not in the ideal linear Hooke's-law model. Real springs can deviate from that model at large extensions.
How do a heavier mass and a stiffer spring change the period?
A heavier mass makes the period longer, because the system changes speed more slowly. A stiffer spring makes it shorter, because it pulls back harder for the same stretch.
How do I convert grams and newtons per centimetre?
Convert to kilograms and newtons per metre before entering the values. For example, 500 grams becomes 0.5 kilograms, and 2 newtons per centimetre becomes 200 newtons per metre.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/mech/shm-period-mass-spring \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"m":2,"k":50}'const res = await fetch("https://api.kit.forhosting.com/mech/shm-period-mass-spring", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"m": 2,
"k": 50
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/mech/shm-period-mass-spring",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"m": 2,
"k": 50
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/mech/shm-period-mass-spring", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"m":2,"k":50}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"m":2,"k":50}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/mech/shm-period-mass-spring", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"m": 2,
"k": 50
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "mech.shm_period_mass_spring",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
It applies the standard simple harmonic motion equation T = 2π√(m/k), using mass m and spring constant k. Run it in the browser or call the API for $0.002 per successful request.
What the mass-spring period represents
For an ideal mass connected to a linear spring, the period is T = 2π√(m/k).
How to enter mass and spring constant correctly
The aliases mass, spring_constant, and stiffness are accepted for convenient integration with forms or existing datasets. In particular, k = 0 is rejected with an invalid_input error because the equation would divide by zero and an unattached mass has no spring-controlled oscillation period.
Assumptions, applications, and limits
The browser calculation is free; automated API requests cost $0.002 per successful request, while validation errors identify unsuitable input before any physically meaningless period is returned.
Technical questions
What formula does the calculator use?
It uses T = 2π√(m/k), the ideal simple harmonic motion period for a mass m attached to a linear spring with stiffness k.
How much does the API request cost?
A successful API request costs $0.002. The same deterministic calculation is available free in the browser.