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.
- 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
Frequently Asked Questions
What does xG of 2.0 mean?
An xG of 2.0 means the team's shots had a combined probability of producing 2 goals. If they scored 3, they outperformed their xG; if they scored 1, they underperformed.
Is xG useful for predicting results?
Yes. Over a season, xG is a better predictor of future results than actual goals scored, because it measures underlying chance quality rather than finishing luck.
What is a good xG per match?
Top teams in major leagues average 1.5-2.5 xG per match. Creating 2+ xG consistently indicates a strong attack regardless of actual goals scored.
Ready to run the numbers?
Open Soccer Expected Goals Calculator