NPCs

An NPC (Non-Player Character) is a friendly automated character that provides some service to players. Players can utilize NPCs by standing near them and right-clicking on them. Most NPCs are vendors, selling items to players in exchange for coins, and can be sold items by a player in order to obtain coins, though some NPCs perform other functions.

Most NPCs are "Town" NPCs, appearing after certain milestones are achieved in game advancement (details below). They move into structures the player builds, known as Houses, which are generally required for Town NPCs to remain available.

Town NPCs that have moved into Houses reduce enemy spawn rates in the area, an effect that multiplies the more of them are present. With four or more Town NPCs in close proximity, enemies generally stop spawning on or near the visible screen altogether. Players tend to utilize this effect by building large structures ("Towns" or "Bases") with several integrated Houses, to serve as their safe haven. Enemy spawn rates in the area return to normal, or are elevated, during Events such as a Blood Moon or Goblin Invasion.

Town NPCs generally walk around during the day, and remain still in their assigned Houses at night. They have finite health and can take damage from enemies or Lava, and can die, though they will respawn following a delay as long as a suitable vacant House is still available. NPCs cannot be attacked by players, and their health regenerates over time.

There are currently 21 Town NPCs. An additional 2 NPCs can be encountered that don't move into Houses.

Housing
Town NPCs require a suitable, vacant House built by a player. A House is a confined room enclosed by a frame of blocks, with a Door, background Walls, and two furniture items. Certain types of furniture are required, as well as certain room dimensions (see Home for details). Houses must not be located near Corruption or Crimson, and if those spread too close to an occupied House, the NPC living there may move out.

Town NPCs' home assignments can be re-arranged using NPC Flags from the Housing Menu, where you can also check whether a room is a suitable House.

The Guide and Old Man are unique in that they always spawn upon creating a world. The Guide will also move into the first House you build. If he dies, he will need a proper House to respawn. The Old Man does not move into a House, but always appears near the Dungeon's entrance, and respawns the following day if killed.

If a House occupied by an NPC is damaged in a way that makes it invalid, the NPC will move out and walk around the area until a suitable House is restored. If killed, the NPC will respawn again whenever a new House becomes available.

Buying and selling
Items can be bought simply by right-clicking an NPC and taking items from their inventory while their cost in coins is available in the player's inventory. Holding the right mouse button will allow the player to buy an item in bulk, so long as the item is stackable. The buy speed increases the longer the right-click button is held. Certain NPC's will sell Biome Specific Items if their House is located within a specific biome.

All NPC vendors can also be used to sell your unwanted or surplus items to gain coins, simply by placing your unwanted item(s) in their inventory. Items are always sold to vendors at one-fifth their purchase price. Not all items have a sell value (very common items such as Dirt or Wood have no value). Hovering over your item while the NPC's inventory is open will show its sell value. Should you change your mind about a sale, sold items can be taken back in exchange for the amount you sold them for, as long you haven't yet closed the NPC's inventory screen. This does not hold true for returning bought items, which must be sold back at their standard sell rate of one-fifth the purchase price.

All NPC vendors buy and sell at the same price.

Town NPCs
Listed in the order in which they are likely to be acquired.

Other NPCs
The following NPCs are not considered town NPCs because they cannot be moved into specific housing. Details below.