Moon phase

The Moon in Terraria moves through a cycle of eight different phases, with the next consecutive phase appearing each night. The current moon phase is indicated by the amount of it that is visible each night. The phase of the moon affects which items certain NPCs sell, as well as certain enemy spawn rates. The first night of a newly created world is always a full moon.

It takes only eight in-game nights for the Moon to move through all of its phases. The different phases include the full moon, where the entire circular moon is visible; and four nights later, the new moon, where no moon is visible. Another four nights later, the full moon returns.

Because of how time works in Terraria, nights last 9 real-life minutes, from 7:30 PM game time to 4:30 AM game time.

A Blood Moon can occur during any moon phase except for a new moon.

With the Halloween update, a new type of moon, the Pumpkin Moon can occur. Unlike other moons, it does not happen randomly or cyclically, and is instead summoned by the player with a Pumpkin Moon Medallion. It functions similarly to an invasion that lasts until dawn. A Pumpkin Moon will override any other type of moon currently active, including the Blood Moon.

New moon
During a new moon, Wraiths, Demon Eyes and Wandering Eyes spawn more often.

Full moon
During a full moon:
 * The Clothier will sell the Plumber's clothes.

If Hardmode is activated:
 * Werewolves will start to spawn, being as common as zombies.

During the day after a full moon:
 * The Clothier will sell The Doctor's clothes.

Blood Moon
When a Blood Moon occurs, the sky turns red. During a Blood Moon:
 * The Arms Dealer will sell Silver Bullets. (Pre-Hardmode)
 * The Clothier will sell the Mime Mask.
 * The Merchant will sell Throwing Knives.
 * The Dryad will stop selling Grass Seeds, Purification Powder and Sunflowers, and will start selling Corrupt Seeds and Vile Powder.
 * The Painter sells Evil Presence painting
 * The Steampunker sells Purple Solution (if the Corruption is present) or Red Solution (if the Crimson is present) instead of Green Solution
 * The Cyborg sells advanced ammunition, namely Rocket II & Rocket III (Note: Cyborg has a small chance to sell these ammunitions without a Blood Moon being present. The Blood Moon merely guarantees it.)
 * Deathweed will bloom. Blood moons are the only time you can harvest Deathweed Seeds from Deathweed.
 * Bunnies and Goldfish will become corrupted.
 * Zombies and Possessed Armors start breaking down doors.
 * The Groom, who is a Zombie may appear and drops the Top Hat upon being killed.
 * During Hardmode the Clown can appear on the surface.
 * Enemy spawn rate and max spawns are significantly increased, and enemies may spawn near NPCs, which normally suppress enemy spawn rates.