Coffee Spill Resonance Risk Calculator

Estimate how likely a cup is to slosh over while you walk by comparing your step frequency to the cup’s natural sloshing frequency. Use it to test “what if I slow down?”, “what if I shorten my stride?”, or “what if I fill the cup less?”

This page is designed to be practical: you can measure the inputs with a ruler and a rough pace estimate, then use the output to pick a safer walking rhythm. The model is intentionally simple so it runs instantly in your browser and stays easy to sanity-check.

How this calculator works (model overview)

A cup of coffee behaves like a small wave tank. When you walk, tiny periodic motions from your body act like repeated nudges. If those nudges happen near the liquid’s natural sloshing frequency, the waves can build up (resonance) and the surface can crest over the rim. This page estimates that resonance risk using a standard first-mode sloshing approximation for a cylindrical cup.

The key idea is that two rhythms matter: the rhythm of your steps and the rhythm of the liquid surface. When those rhythms align, each step tends to push the liquid in the same direction at the same point in its cycle. That repeated “in-phase” forcing is what makes a calm surface suddenly become a spill.

Inputs and units (what to measure)

  • Cup Diameter (cm): the inner diameter of the cup opening. If the cup tapers, use the diameter near the liquid surface.
  • Fill Depth (cm): vertical depth of liquid (not the cup height). Measure from the bottom to the liquid surface.
  • Walking Speed (m/s): your forward speed. Typical walking is roughly 1.0–1.6 m/s.
  • Step Length (m): distance per step (not per stride). Typical values are about 0.6–0.8 m.

Tip: if you only know cadence in steps/min, you can convert to step frequency in Hz by dividing by 60. This calculator instead uses speed and step length, because those are easy to estimate together.

Measurement tip: for step length, count 10 steps at a comfortable pace and measure the distance from your starting toe to your ending toe, then divide by 10. For speed, time yourself over a known distance (for example, 20 meters in a hallway) and compute speed = distance/time.

Formulas used

The calculator computes two frequencies:

  1. Step frequency (how often you “kick” the cup): Formula: fw = vL

    Where v is walking speed (m/s) and L is step length (m). The result is in Hz (steps per second).

  2. Sloshing frequency (first mode for a circular cup): fs = 12π g k · tanh (kh)

    with g = 9.81 m/s² and k = 1.841 / D, where D is cup diameter (meters) and h is fill depth (meters).

The risk score increases when fw is close to fs and when the cup is relatively full. Internally, the script uses a Gaussian-shaped resonance window (controlled by a constant sigma) and multiplies it by a fill factor capped at 1.

Worked example (realistic numbers)

Suppose you have a typical ceramic mug and a normal walking pace:

  • Cup Diameter: 8.0 cm
  • Fill Depth: 6.0 cm
  • Walking Speed: 1.4 m/s
  • Step Length: 0.70 m

Step frequency is fw = 1.4 / 0.70 = 2.0 Hz. The sloshing frequency depends on diameter and depth; if the computed sloshing frequency lands near 2.0 Hz, the risk will rise. If it lands far away (for example 1.2 Hz or 3.0 Hz), the risk will drop.

After you run the calculator, sanity-check the output: sloshing frequencies for mugs are commonly in the ~1–3 Hz range, which is exactly why walking can excite them.

Scenario comparison example: keep the same mug and fill depth, but slow down to 1.1 m/s while keeping step length about 0.70 m. Your step frequency becomes 1.1/0.70 ≈ 1.57 Hz. If your mug’s slosh frequency is near 2.0 Hz, that small change can move you away from resonance and noticeably reduce the score.

How to interpret the results

  • Sloshing freq: the cup’s estimated natural frequency (Hz). This is set mostly by cup diameter and fill depth.
  • Step freq: your step frequency (Hz). This is set by speed and step length.
  • Spill risk: a relative score (0–100%). Use it to compare scenarios, not as a guaranteed probability.

Practical rule: if the risk is high, change one thing at a time (slow down, speed up slightly, shorten stride, or reduce fill depth) and re-run. The safest change is often reducing fill depth, because it reduces the fill factor directly.

Another sanity check: if you double your speed while keeping step length the same, step frequency doubles. If the risk score changes dramatically, that is expected because resonance is sensitive to frequency alignment. If the score barely changes, you are likely far from resonance.

Typical values you can start with

Typical cup and walking values for testing the calculator
Scenario Diameter (cm) Depth (cm) Walking Speed (m/s) Step Length (m)
Office mug, half full 8 6 1.4 0.7
Travel tumbler, near brim 7 15 1.2 0.65
Large café cup, leisurely 10 5 1.0 0.75
Paper cup, rushing 9 8 1.6 0.70

Limitations and assumptions

This is a simplified physics-based estimate intended for everyday intuition and scenario comparison.

  • Cup shape: assumes a rigid, cylindrical cup. Tapered cups, lids, and baffles change the dynamics (often reducing spill risk).
  • Walking motion: assumes a steady cadence. Real steps vary, which can spread energy across frequencies and reduce peak resonance.
  • Damping: ignores many damping effects (hand/arm absorption, viscosity, foam, lid contact). These usually lower real-world slosh.
  • Not a guarantee: the score is not a certified probability. Use it as a relative indicator and always use common sense (especially with hot liquids).

If you are carrying very hot drinks, treat this as a comfort-and-cleanliness tool, not a safety certification. A lid and a stable grip are still the best protection.

Quick strategies to reduce spills

  • Change cadence: slightly slower or slightly faster can move you away from resonance.
  • Shorten stride: for the same speed, shorter steps increase step frequency; for the same cadence, shorter steps reduce speed.
  • Lower fill depth: reduces the fill factor and often reduces wave growth.
  • Use a lid or travel mug: adds damping and reduces free-surface motion.
  • Carry close to your body: reduces arm-induced oscillations and adds damping through your grip.
  • Pause before stairs and turns: turns and step-ups add lateral acceleration that can excite slosh even when your straight-line cadence is safe.

Practical notes (what the model does not see)

Real spills are often triggered by events that are not perfectly periodic: a sudden stop, a door handle pull, a bump in the sidewalk, or a quick pivot to avoid someone. Those events inject energy across many frequencies, not just your step frequency. That is why you can sometimes spill even when the calculator shows a low resonance score.

On the other hand, many everyday factors reduce slosh compared to the idealized model: foam on top of a latte, viscosity from milk, a narrow sipping opening, or simply the damping from your hand and wrist. In practice, the calculator is most useful for answering a narrow question: “Is my current walking rhythm close to the cup’s natural rhythm?”

Frequently asked questions (quick answers)

Why does a narrower cup often feel easier to carry?

Narrower cups tend to have a higher natural sloshing frequency (because the characteristic length scale is smaller). Typical walking step frequencies are around 1.5–2.5 Hz, so shifting the cup’s slosh frequency away from that band can reduce resonance.

Does filling the cup more always increase risk?

In this model, a fuller cup increases the fill factor up to a cap, which raises the score when you are near resonance. In real life, very shallow fills can also slosh noticeably, but they have more headroom before spilling. The most reliable way to reduce spills is to leave more space below the rim.

What if I know my cadence but not my speed?

You can still use the calculator by choosing a reasonable step length and solving for speed: speed = cadence(Hz) × step length. For example, 120 steps/min is 2.0 Hz. With a 0.70 m step length, speed ≈ 1.4 m/s.

Steady Steps (mini-game)

Try a quick, hands-on demo of the same idea: when your step rhythm approaches the cup’s slosh rhythm, waves grow faster. Tilt to counter the slosh and click/tap to speed up. The game uses the same sloshing-frequency formula shown above: f = (1/2π)√(gk·tanh(kh)).

Accessibility note: the mini-game is optional. The calculator above and below works fully without it. If you prefer reduced motion, your system setting will reduce transitions, and you can simply skip this section.

Balance the slosh, avoid resonance

Tilt to stabilize · Tap/click to walk faster · Reach the door without spilling

Distance
0m

Goal:

Coffee Left
100%

Best: 0m

How to play

Calculate your spill risk

Inner diameter at the liquid surface. Example: 8.0 cm.

Depth of liquid (not cup height). Example: 6.0 cm.

Typical walking is about 1.0–1.6 m/s.

Distance per step. Example: 0.70 m.

Skip to results
Enter your cup and gait details above.

Next steps (use the score to make a decision)

Once you see your sloshing frequency and step frequency, try to create a “safe gap” between them. If they are close, adjust either your walking rhythm (speed or step length) or the cup conditions (diameter or fill depth). For example, if you cannot change your pace because you are late, lowering the fill depth by even 1–2 cm can reduce the score and give you more headroom below the rim.

If you are experimenting, write down your inputs for two or three runs (baseline, slower, faster). The most useful output is often not the absolute percentage but the direction of change: did the score drop when you slowed down, or did it drop when you sped up? That tells you which side of resonance you are on.

Embed this calculator

Copy and paste the HTML below to add the Coffee Spill Resonance Risk Calculator (Walking With a Cup) to your website.