How to compute a slot machine's RTP
I computed my demo slot's return to player exactly from its reel strips, then checked it with a 20-million-spin simulation. The method and the numbers.
· Updated · 5 min read

A slot machine's return to player (RTP) can be computed exactly from its reel strips, without simulating a single spin. You sum the pay of every symbol combination, each weighted by the chance that the reels land on it. A simulation then serves as a cross-check, not as the source of the number.
I built a slot for play credits only, Neon Strip, and kept its math apart from the animation. Its RTP is 96.04%. This post is how I got that number and what I changed on the way to it. There is no real money and no prize in the demo.
Keep the math away from the screen#
All the rules live in one folder of plain TypeScript with no graphics code: reel strips, the paytable, line evaluation, scatters, free spins and a seeded random generator. One function takes the state and a random generator and returns a typed result: where each reel stopped, the line wins, the stars, the total win and how many spins were awarded.
In a real product that function would run on a gaming server with a certified random number generator. In the demo the client only animates what it gets back. The split matters for this post because it is what makes the math testable: a simulation can run the real rules with no browser.
The machine in one paragraph#
Five reels, three rows and ten fixed lines. Lines pay left to right with wild substitution, and the highest win per line counts. A wild lands on reels 2 to 4. Star scatters start eight free spins in which every win is doubled and wilds expand to fill their reel, and free spins can retrigger.
Exact RTP from the strips#
Every line takes one uniform cell from each reel. That means the chance of a given symbol combination on a line is the product of the per-reel probabilities of those symbols, and the expected pay of a line is a sum over symbol combinations of probability times pay.
For the base game, that is a direct sum. For free spins, the expanding wild adds an outcome per reel: "this reel expanded to wild". The calculation includes that as a separate case for each reel. Retriggers form a geometric series. Each free spin has the same chance q to award eight more, so the expected number of spins per feature has a closed form: 8 / (1 − 8q).
The result for my strips:
| Part | Share of the return |
|---|---|
| Base game | 64.5% |
| Free spins | 31.5% |
| Total RTP | 96.04% |
Free spins start about once in 91 spins.
Check it with a simulation#
A seeded simulation of 20 million spins, played as whole sessions, returned 96.19% with a hit rate of 27.6%. The exact figure is 96.04%, so the simulation sits 0.15 percentage points higher. The long test allows a gap of up to 0.5 points and passes. I have not worked out a confidence interval for the run, so I cannot say whether the gap is only noise from a high-variance feature or a small bug. For a demo I accept it. For a game that would be certified, that gap would have to be explained.
The unit tests check the exact figure, a 400,000-spin seeded run and the line rules. The 20-million-spin run is slow, so it sits behind an environment variable, SLOT_SIM=1.
The first draft returned too much#
My first version had wilds on all five reels. With expanding wilds, the free spins alone returned over 100%, which means the feature paid more than the whole machine should.
Two changes fixed it. Wilds now land only on reels 2 to 4, and the outer reels carry one star instead of two. That keeps the feature near a third of the total return, which is the 31.5% above. Then I scaled the pays to land on 96%.
An exact calculation, unlike a simulation, shows the effect of a change immediately, with no run to wait for.
Rules for the interface#
A state machine drives the client: idle, request, spinning, stopping, present, feature intro and feature outro. An event that is not valid in the current state throws, so a double click or a stray key cannot start a second spin.
Space, Enter or the button stops every reel at once, and a turbo mode shortens everything. Autoplay runs 10, 25 or 50 spins and stops on free spins, a 25x win, low credits or a hidden tab.
Regulated markets restrict features like these. Trade press reports that the UK Gambling Commission required operators to remove autoplay, turbo and slam-stop features and spin speeds faster than 2.5 seconds by 31 October 2021 (for example SBC News). I did not read the Commission's own statement. My demo has turbo and autoplay because it uses play credits, and a build for a regulated market would turn off turbo, autoplay and the stop-all button, and keep each spin at least 2.5 seconds long.
Accessibility#
Under reduced motion the reels swap to the result behind a short fade, with no wind-up, bounce, motion blur, particles, flicker or count-ups. Neon flicker elsewhere stays far below three flashes a second. A polite live region reads every result out, and the canvas is hidden from screen readers.
What the number does not show#
The 96.04% is the return of my own strips and my own rules. No lab has certified it, and I have not compared my method with a published slot-math reference. The 0.15-point gap to the simulation is unexplained. The demo is not gambling and teaches nothing about winning: the machine is built to return less than it takes.