golf-handicap-calc
v1.0.0
Published
Golf Handicap Index calculator using the World Handicap System formula. Full guides: https://golflaunchlab.com/guides/golf-swing-speed-chart
Maintainers
Readme
golf-handicap-calc
Golf Handicap Index calculator using the World Handicap System (WHS) formula. Computes score differentials, handicap indexes from multiple rounds, course handicaps for specific courses, and net double bogey maximums.
Knowing your handicap helps you set realistic improvement goals. Pair handicap tracking with a launch monitor to measure the swing metrics behind your scores and identify exactly where strokes are being lost.
Installation
Python
pip install golf-handicap-calcJavaScript / Node.js
npm install golf-handicap-calcUsage
Python
from golf_handicap_calc import score_differential, handicap_index, course_handicap, max_score
# Calculate a single score differential
diff = score_differential(gross_score=85, course_rating=71.2, slope_rating=128)
print(diff) # 12.2
# Calculate Handicap Index from recent rounds
rounds = [
{"gross_score": 85, "course_rating": 71.2, "slope_rating": 128},
{"gross_score": 88, "course_rating": 72.5, "slope_rating": 135},
{"gross_score": 82, "course_rating": 69.8, "slope_rating": 121},
{"gross_score": 90, "course_rating": 73.1, "slope_rating": 131},
{"gross_score": 87, "course_rating": 71.8, "slope_rating": 126},
]
result = handicap_index(rounds)
print(f"Handicap Index: {result['handicap_index']}")
print(f"Used {result['differentials_used']} best of {result['total_rounds']} rounds")
# Convert to Course Handicap for a specific course
ch = course_handicap(handicap_idx=15.2, slope_rating=128, course_rating=71.2)
print(f"Course Handicap: {ch['course_handicap']}")
print(f"Playing Handicap (95%): {ch['playing_handicap']}")
# Net Double Bogey maximum score
print(f"Max score on a par 4: {max_score(par_hole=4, course_handicap_value=20)}")JavaScript
const { scoreDifferential, handicapIndex, courseHandicap, maxScore } = require('golf-handicap-calc');
// Calculate a single score differential
const diff = scoreDifferential(85, 71.2, 128);
console.log(diff.differential); // 12.2
// Calculate Handicap Index from recent rounds
const rounds = [
{ grossScore: 85, courseRating: 71.2, slopeRating: 128 },
{ grossScore: 88, courseRating: 72.5, slopeRating: 135 },
{ grossScore: 82, courseRating: 69.8, slopeRating: 121 },
{ grossScore: 90, courseRating: 73.1, slopeRating: 131 },
{ grossScore: 87, courseRating: 71.8, slopeRating: 126 },
];
const result = handicapIndex(rounds);
console.log(`Handicap Index: ${result.handicapIndex}`);
console.log(`Used ${result.differentialsUsed} best of ${result.totalRounds} rounds`);
// Convert to Course Handicap
const ch = courseHandicap(15.2, 128, 71.2);
console.log(`Course Handicap: ${ch.courseHandicap}`);
console.log(`Playing Handicap (95%): ${ch.playingHandicap}`);
// Net Double Bogey max score
console.log(`Max score on a par 4: ${maxScore(4, 20)}`);How the World Handicap System Works
The WHS calculates your Handicap Index by:
- Score Differentials are computed for each round:
(113 / Slope) * (Score - Course Rating) - The best differentials are selected from your most recent 20 rounds (e.g., best 8 of 20)
- Those best differentials are averaged to produce your Handicap Index
- A Course Handicap is then derived for each course you play based on its slope and rating
| Rounds Available | Best Differentials Used | Adjustment | |-----------------|------------------------|------------| | 3 | 1 | -2.0 | | 4 | 1 | -1.0 | | 5 | 1 | 0.0 | | 6 | 2 | -1.0 | | 7-8 | 2 | 0.0 | | 9-11 | 3 | 0.0 | | 12-14 | 4 | 0.0 | | 15-16 | 5 | 0.0 | | 17 | 6 | 0.0 | | 18-19 | 7 | 0.0 | | 20 | 8 | 0.0 |
Improving Your Handicap
Your handicap reflects real scoring performance, but improving it requires understanding the underlying swing mechanics. A launch monitor measures the club and ball data that directly affects your scores:
- Golf Swing Speed Chart -- see how your swing speed compares to tour averages
- Average Swing Speed by Age -- benchmark your speed against your age group
- Golf Club Distance Chart -- match your distances to the right clubs
- How to Increase Swing Speed -- training methods that translate directly to lower scores
Related
License
MIT License -- copyright 2026 GolfLaunchLab. See LICENSE for details.
