πŸ› οΈToolsShed

Running Pace Calculator

Calculate running pace, speed, time, and distance for any race distance.

Unit
::

Running Pace Calculator converts between pace (minutes per kilometer or mile), speed (km/h or mph), and finish time for common race distances. It is an essential tool for race planning, training prescription, and comparing performance across different distances.

Enter any two of the three variables β€” distance, time, and pace β€” and the tool calculates the third. You can also enter a target finish time for a race (5K, 10K, half marathon, or full marathon) and the tool tells you the required pace per kilometer and per mile to achieve it.

Understanding your pace is key to avoiding going out too fast at the start of a race (a common mistake that leads to exhaustion in the second half) and for structuring interval training sessions with accurate target paces. Most training plans prescribe workouts at specific paces like easy, threshold, and interval pace.

Frequently Asked Questions

Code Implementation

def pace_to_speed(pace_min_per_km):
    """Convert pace (min/km) to speed (km/h)."""
    return 60 / pace_min_per_km

def speed_to_pace(speed_km_h):
    """Convert speed (km/h) to pace (min/km)."""
    return 60 / speed_km_h

def pace_min_km_to_min_mile(pace_min_per_km):
    """Convert pace from min/km to min/mile."""
    return pace_min_per_km * 1.60934

def finish_time_seconds(distance_km, pace_min_per_km):
    """Calculate finish time in seconds."""
    return distance_km * pace_min_per_km * 60

def format_time(total_seconds):
    """Format seconds as H:MM:SS."""
    total_seconds = int(round(total_seconds))
    h = total_seconds // 3600
    m = (total_seconds % 3600) // 60
    s = total_seconds % 60
    if h > 0:
        return f"{h}:{m:02d}:{s:02d}"
    return f"{m}:{s:02d}"

def format_pace(pace_decimal_minutes):
    """Format decimal minutes as M:SS per km."""
    m = int(pace_decimal_minutes)
    s = round((pace_decimal_minutes - m) * 60)
    if s == 60:
        m += 1; s = 0
    return f"{m}:{s:02d}"


# Standard race distances in km
RACES = {
    "5K":           5.0,
    "10K":          10.0,
    "Half Marathon": 21.0975,
    "Marathon":     42.195,
}

pace_min_km = 5.5  # e.g., 5:30 per km
print(f"Pace: {format_pace(pace_min_km)} /km")
print(f"Speed: {pace_to_speed(pace_min_km):.2f} km/h")
print(f"Pace in min/mile: {format_pace(pace_min_km_to_min_mile(pace_min_km))}")
print()

print("Race finish times:")
for race, dist in RACES.items():
    secs = finish_time_seconds(dist, pace_min_km)
    print(f"  {race:<16} {format_time(secs)}")

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.