Terraria has 26 town NPCs, each with its own move-in condition. Here is how to unlock every one, how to build a valid house and how happiness and Pylons work.
Terraria has 26 town NPCs, and each one moves in once you meet its condition and have a free valid house. Most conditions are simple, like having enough money, beating a certain boss or finding the NPC somewhere in the world.
Town NPCs sell items, offer services and unlock new crafting options, so getting all of them is a big part of progress. The table below lists every NPC and how to unlock it, and the sections after it explain the houses, happiness and Pylons.
| NPC | How To Unlock | Hardmode |
|---|---|---|
| Guide | There from the start | No |
| Merchant | Carry more than 50 silver | No |
| Nurse | More than 100 max health, Merchant present | No |
| Demolitionist | Carry an explosive, Merchant present | No |
| Angler | Talk to him at the Ocean | No |
| Zoologist | Fill 10% of the Bestiary | No |
| Dryad | Beat Eye of Cthulhu, Eater of Worlds, Brain of Cthulhu or Skeletron | No |
| Arms Dealer | Carry a gun or bullets | No |
| Golfer | Find him in the Underground Desert | No |
| Stylist | Free her from a Spider Nest | No |
| Tavernkeep | Wake the Unconscious Man after Eater of Worlds or Brain of Cthulhu | No |
| Goblin Tinkerer | Free him in the Cavern after a Goblin Army | No |
| Witch Doctor | Beat Queen Bee | No |
| Clothier | Beat Skeletron | No |
| Mechanic | Free her in the Dungeon | No |
| Dye Trader | Carry a dye or dye plant, 4 other NPCs | No |
| Painter | 8 other NPCs | No |
| Party Girl | 20 other NPCs, then a 1 in 40 chance | No |
| Wizard | Free him in the Cavern | Yes |
| Truffle | Free house in a surface Mushroom biome | Yes |
| Pirate | Beat a Pirate Invasion | Yes |
| Steampunker | Beat any mechanical boss | Yes |
| Cyborg | Beat Plantera | Yes |
| Tax Collector | Purification Powder on a Tortured Soul in the Underworld | Yes |
| Santa Claus | Beat the Frost Legion, Christmas season only | Yes |
| Princess | Every other town NPC except Santa Claus | Yes |
An NPC only moves in when a free house meets every rule. Each house needs:
The house must not be in the Corruption, Crimson or other evil biomes. Use the Housing menu (the house icon in your inventory) and click "Housing Query" on a room to check whether it counts.

The Guide is there from the first second. The Merchant arrives once you carry more than 50 silver, and the Nurse once you have more than 100 maximum health and the Merchant lives in your town. The Demolitionist follows when you carry an explosive, such as a bomb or dynamite, with the Merchant already present.
The Angler is asleep at the Ocean. Talk to him once and he moves into a free house. The Zoologist moves in when your Bestiary is at least 10% filled.
Four NPCs must be rescued before they move in. Find them, talk to them, and they need a free house:
For the Goblin Army, see How To Start The Goblin Army Event.
The Dryad arrives after you beat the Eye of Cthulhu, the Eater of Worlds, the Brain of Cthulhu or Skeletron. The Arms Dealer needs a gun or bullets in your inventory. The Witch Doctor moves in after Queen Bee, and the Clothier after Skeletron.
The Tavernkeep is the Unconscious Man, who can turn up in any layer after you beat the Eater of Worlds or the Brain of Cthulhu. Talk to him to wake him. The Dye Trader needs a dye or dye plant in your inventory and 4 other NPCs. The Painter moves in once you have 8 other NPCs.
The Party Girl is the slow one. She needs 20 other NPCs, and even then she only has a 1 in 40 chance to move in each time the game checks. The Old Man and the Traveling Merchant count toward the 20.

These NPCs only arrive after the Wall of Flesh:
For the mechanical bosses and Plantera, see How To Summon The Destroyer and How To Summon Plantera.

The Princess is the last NPC. She moves in once every other town NPC except Santa Claus lives in your world, which means after Plantera, since the Cyborg must be there first.
Three NPCs don't need a house. The Traveling Merchant visits on random days between 4:30 AM and noon once you have 2 town NPCs, and leaves at 6 PM. The Skeleton Merchant wanders the Cavern layer and sells different items with each moon phase. The Old Man stands at the Dungeon entrance and is the one you curse to fight Skeletron.

Each NPC has a happiness level that changes its prices. A happy NPC sells for as little as 75% of the normal price, and an unhappy one charges up to 150%. Happiness depends on three things:
Talk to an NPC and click "Happiness" to see what it thinks of its home. Small towns of two or three NPCs in their favorite biomes are the easiest way to keep everyone happy.
Pylons let you teleport between towns. Each one costs 10 gold and is sold by most NPCs when you stand in the matching biome with at least one other NPC nearby. The Universal Pylon costs 1 platinum.

A Pylon only works when at least 2 town NPCs live near it, and it must stand in the biome it is named for. Note: The Tavernkeep, Traveling Merchant and Skeleton Merchant never sell Pylons, and no NPC sells them in the Corruption or Crimson.