How xG is calculated
An xG model looks at a shot the moment before it is struck, compares it with a huge archive of past shots, and returns the share that ended in a goal. The inputs, and how they are weighed, are what make one model different from another.
Where the shot is taken from
Location matters more than anything else. Two numbers describe it: the distance to the goal and the angle, how much of the goal mouth the shooter can see. Close and central is good; far or wide is poor. Every model starts here.
What else a model knows
In almost every model
Distance and angle; body part (foot or head: headers are scored far less often from the same place); situation (open play, counter-attack, corner, free kick, penalty).
In most modern models
The action before the shot (a cross, a through ball, a cutback, a rebound); whether the shot was first-time; how the attack developed.
In premium models only
Where the goalkeeper stands, how many defenders block the way, the pressure on the shooter and how clear the view of goal is. StatsBomb records every visible player at the moment of the shot; Opta's model uses keeper position, pressure and clarity among more than 20 inputs.
Keeper position can change a value a lot. In one published StatsBomb example, a shot worth about 0.30 in a basic model was worth about 0.65 once the model knew the goalkeeper was out of position.
From inputs to a probability
Early models were logistic regressions: a formula with a weight for each input, first published in academic work in 1997. Modern providers use machine learning: Opta describes gradient-boosted trees (XGBoost) trained on about one million shots from 40 competitions; StatsBomb uses gradient-boosted trees with rules that keep the model sensible (for example, closer can never be worse); Understat says it uses a neural network trained on over 100,000 shots.
The model is trained on the past and then frozen. A shot today is valued by what similar shots did in the training data. Models are retrained from time to time, which is why the same shot can be worth a little more or less after an update.
What a model does not know
- Who shoots. Most models value the chance for an average player against an average keeper. A great finisher and a defender get the same value from the same spot.
- Where the ball went. Placement and power only count in post-shot models (xGOT, PSxG), which measure the shot itself, not the chance.
- Chances without a shot. A cross that flashes across the six-yard box untouched has no xG at all.
- The score. Most models ignore whether a team is leading or chasing, although leading teams take fewer, better shots.
Questions
Is there a formula for xG?
Not one formula. Old models were simple regressions with a weight per input; today's are machine-learning models trained on hundreds of thousands of shots. Each provider has its own.
Does xG include the goalkeeper?
In premium models, the keeper's position is an input. The keeper's skill is not: that belongs to post-shot measures such as goals prevented.
Why is a header worth less than a shot from the same spot?
Headers are scored much less often. In StatsBomb's older data, foot shots in the six-yard box were scored about 40% of the time and headers under 25%.
Sources
- Opta Analyst: What is expected goals (xG)? · 2023
- Opta Analyst: Evolving expected goals (the 2022 model) · April 2022
- Hudl StatsBomb: Expected goals (xG) explained
- Hudl StatsBomb: Upgrading expected goals · May 2022
- Understat
- Bajons & Kook: expected goals models (arXiv) · 2025
- StatsBomb (Trainor): How do headers compare to shots? · 2013
- American Soccer Analysis: explanation of models
Checked 2026-10-28. Methods change: every figure here is dated to its source.
xG explains football; it is not a betting tip. 18+ · Please gamble responsibly.