Blog ·
How do the ghosts in Pac-Man work?

Each ghost in Pac-Man is steered toward its own target tile, and the four targets are worked out differently: Blinky (red) aims at Pac-Man's own tile, Pinky (pink) at a spot four tiles ahead of him, Inky (cyan) at a spot found by doubling a line from Blinky, and Clyde (orange) at Pac-Man only while he is far away. At every turning a ghost simply takes the way that brings it closest to its target, and several times a level all four stop chasing and "scatter" to their own corners. That is why the ghosts seem to have personalities and to trap you together, even though none of them knows where the others are going.
Most of what follows comes from The Pac-Man Dossier by Jamey Pittman, the long study of the 1980 arcade game's code and behavior that players and programmers have leaned on since Gamasutra ran it in 2009. The design thinking comes from Pac-Man's creator, Toru Iwatani, in his 1986 interview in Susan Lammers' book Programmers at Work (reprinted here).
Why do the ghosts act differently?
Because Iwatani wanted them to. In his Programmers at Work interview he said he wanted each ghost "to have a specific character and its own particular movements, so they weren't all just chasing after Pac Man in single file". Four ghosts all taking the shortest path to you would bunch up into a line behind you, which is easy to outrun. Four ghosts aiming at different points spread out and close in from different sides.
He also did not want them to attack all the time. He felt it would be "too stressful" for Pac-Man to be "continually surrounded and hunted down", so, in his words, "I created the monsters' invasions to come in waves". That is the scatter and chase cycle below.
What are the ghosts' names?
The Dossier gives each ghost a character name and a nickname, in English and in Japanese:
| Color | Nickname | Character | Japanese character | What it means |
|---|---|---|---|---|
| Red | Blinky | Shadow | Oikake | "to run down or pursue" |
| Pink | Pinky | Speedy | Machibuse | "to perform an ambush" |
| Cyan | Inky | Bashful | Kimagure | "a fickle, moody, or uneven temper" |
| Orange | Clyde | Pokey | Otoboke | "pretending ignorance" |
The meanings in quotation marks are the Dossier's own translations. In Japan, where the game first came out as Puck-Man, the ghosts were named Akabei, Pinky, Aosuke and Guzuta, the last meaning "one who lags behind".
How does a ghost decide which way to go?
The rule is the same for all four, and it is simpler than it looks. As the Dossier explains, when a ghost comes to a turning it:
- Throws out the way it came, because a ghost may not turn around on its own.
- Looks one tile past the turning in each direction that is left.
- Picks the direction whose tile is closest, in a straight line, to its target tile.
- Breaks a tie in this order: up, left, down, right.
That is all. There is no path finding through the maze, and no ghost looks more than one tile ahead, which is why a ghost can take the "wrong" way around a wall and why skilled players can lead them around a block. The only difference between the four ghosts is which tile each one aims at.
Where does each ghost aim?
In chase mode, each ghost's target is worked out from Pac-Man's position, and in one case from another ghost's. These are the Dossier's chapter on the ghosts:
- Blinky uses "Pac-Man's current tile as his target". He follows you most directly, and he is the one Iwatani described as the ghost that "did chase directly after Pac Man".
- Pinky aims four tiles in front of Pac-Man, in the way he is facing, so she tends to cut you off instead of following. A bug in the original code means that when Pac-Man faces up, her target is four tiles up and four tiles to the left.
- Inky takes the spot two tiles in front of Pac-Man, draws a line from Blinky to that spot, and doubles it. The result is that Inky's target swings around with Blinky's position: when Blinky is close behind you, Inky closes in from the other side, and when Blinky is far away, Inky can wander off.
- Clyde targets Pac-Man directly while he is eight tiles or more away, just as Blinky does. Closer than that, he gives up and heads for his scatter corner, so he keeps coming toward you and then veering away.
Iwatani's own description of the effect, in the 1986 interview, is two ghosts moving independently, "almost 'sandwiching' him".
What are scatter mode and frightened mode?
The ghosts switch between three modes, which the Dossier describes in detail:
| Mode | What the ghosts do |
|---|---|
| Chase | Aim at their own target tiles, as above |
| Scatter | Each heads for a fixed corner (Blinky top right, Pinky top left, Inky bottom right, Clyde bottom left) and circles there |
| Frightened | After Pac-Man eats an energizer, they turn blue, slow down and pick a direction at random at each turning |
On level 1 the cycle runs scatter 7 seconds, chase 20, scatter 7, chase 20, scatter 5, chase 20, scatter 5, and then chase for good. On later levels the breaks shrink: the fourth scatter lasts "only 1/60th of a second" from level 2 on, and chase periods grow to more than 1,000 seconds. Each scatter corner's target tile sits outside the maze where no ghost can reach it, which is why a scattering ghost goes around in circles near its corner.
Every change between chase and scatter, and from either one into frightened, forces all the ghosts to reverse direction, which is the one time they turn around. A sudden reversal is your sign that the mode has changed.
Frightened mode is not truly random. The Dossier shows that the game uses a pseudo-random number generator that starts from the same seed at the beginning of every level and after every lost life, which is part of why fixed routes called patterns work. How long the ghosts stay blue shrinks as the levels go up, from 6 seconds on level 1 until they no longer turn blue at all.
Do the ghosts get faster?
Yes, and Blinky most of all. On level 1, by the Dossier's speed table, Pac-Man moves at 80% of the game's top speed and the ghosts at 75%, so you can just outrun them; frightened ghosts slow to 50% and any ghost in the side tunnel to 40%. Pac-Man is not slowed in the tunnel, which makes it a good escape.
Blinky also has a second gear the Dossier calls "Cruise Elroy": on level 1 he speeds up when 20 dots are left and again at 10. While he is in that state he keeps chasing you even during scatter.
There are also two stretches of corridor, one just above the ghost house and one in the corridor where Pac-Man starts, below it, where ghosts may not turn upward during chase or scatter. Players use them to hide, and the Dossier marks them on its maps.
What happens with more than one Pac-Man?
The arcade game has one Pac-Man at a time, so every ghost aims at the same player. Our own maze game, Munchman, lets up to four players eat the same maze in the browser at once, and that changes the ghosts' problem: whom to chase? We read its code on Nov 7, 2026, and this is how its ghosts, called Hoonos, decide:
| Pac-Man (1980) | Munchman | |
|---|---|---|
| Players | One | Up to four in the same maze, over the internet |
| Each ghost's target | Its own tile, worked out from Pac-Man (and Blinky) | The nearest player that is still alive |
| At a turning | The tile closest to the target, never reversing | The same rule |
| Breaks from the chase | Scatter waves to the corners | None: the Hoonos chase all the time |
| Power pellet | Ghosts reverse, turn blue and wander | The same, for 8 seconds on level 1, a little less each level |
| Speed | Ghosts a little slower than Pac-Man | Hoonos a little slower than the players, faster every level |
Because every Hoono chases whoever is closest, players can pull them apart or lead them off each other, and the game's server, not any one player's browser, decides where every Hoono goes, so all four players see the same chase. Eat Hoonos in a row on one power pellet and they are worth 200, 400, 800 and then 1,600 points, as in the arcade. Our post on multiplayer browser games explains how a game like this keeps four players in step.
Where can you learn more?
The full Pac-Man Dossier goes much further, into the dot counters that decide when each ghost leaves the house, the exact speeds on every level, and the famous level 256 split screen. Our Pac-Man page gathers the games inspired by it, and our 1980s page has more classics of the era.
Play Munchman, or browse the hub for more games and the classics behind them.
More from the blog
Why are browser games silent until you click?Browsers block sound on a page until you interact with it, so a web game cannot play audio before your first click, tap or key press. Here is how the rule works and why it exists.
What is procedural generation in games?Procedural generation means a game builds its levels, maps or worlds with rules and random numbers instead of storing each one made by hand. Here is how it works, what a seed is, how Rogue, Elite, Minecraft and No Man's Sky used it, and three browser games where you can see it.
What was the first computer RPG?The earliest computer role-playing game that still survives is pedit5, also called The Dungeon, written by Rusty Rutherford on the PLATO system at the University of Illinois in 1975. Here is how it played, the rival that followed it, the lost game called m199h, and where you can try them today.