Soccer Expected Goals Calculator Formula
Understand the math behind the soccer expected goals calculator. Each variable explained with a worked example.
Formulas Used
Total Expected Goals
total_xg = shots_inside_box * 0.12 + shots_outside_box * 0.03 + headers * 0.06 + penalties * 0.76Total Shots
total_shots = shots_inside_box + shots_outside_box + headers + penaltiesxG per Shot
xg_per_shot = (shots_inside_box * 0.12 + shots_outside_box * 0.03 + headers * 0.06 + penalties * 0.76) / max(shots_inside_box + shots_outside_box + headers + penalties, 1)Variables
| Variable | Description | Default |
|---|---|---|
shots_inside_box | Shots Inside the Box | 8 |
shots_outside_box | Shots Outside the Box | 5 |
headers | Headers | 3 |
penalties | Penalties Taken | 1 |
How It Works
Expected Goals (xG) in Soccer
Expected goals (xG) measures the quality of scoring chances by assigning each shot a probability of being scored based on historical data.
Simplified xG Values
Total xG = Sum of all shot xG values
Professional xG models use 10+ variables including exact location, body part, assist type, game state, and goalkeeper position.
Worked Example
A team takes 8 shots inside the box, 5 outside, 3 headers, and 1 penalty.
shots_inside_box = 8shots_outside_box = 5headers = 3penalties = 1
- 01Inside box xG = 8 x 0.12 = 0.96
- 02Outside box xG = 5 x 0.03 = 0.15
- 03Headers xG = 3 x 0.06 = 0.18
- 04Penalties xG = 1 x 0.76 = 0.76
- 05Total xG = 0.96 + 0.15 + 0.18 + 0.76 = 2.05
Ready to run the numbers?
Open Soccer Expected Goals Calculator