Undertale keeps score. It watches how many monsters you spare and
how many you don't, and it shapes the rest of the game — dialogue,
music, who's still alive to talk to you — around that running total.
Broadly, playthroughs sort into three routes.
Default
Neutral Route
What you get by default: a mix of sparing and fighting, or a
pacifist run missing one required story beat. Neutral has the most
variation of the three, with dozens of small epilogue variants
depending on exactly who lived and who didn't.
True ending
Pacifist Route
Achieved by sparing or befriending every monster you meet and
resolving every boss encounter without a single kill. Widely
considered the "true" ending: it's the only route that resolves
the barrier, the war, and Asgore and Toriel's history in full.
Hard mode
Genocide Route
The inverse: hunting down and clearing out every monster in every
area before proceeding. The game notices, remembers, and does not
make it easy — mechanically or otherwise — and the ending is
built to make sure you feel every bit of that choice.
Routes can be mixed and are individually trackable — the game's
internal flags care about specific actions, not vibes — which is
why two "Neutral" runs can end up looking nothing alike.