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.

New moon
During a new moon, Wraiths, Demon Eyes, Wandering Eyes and Fireflies 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, Penguins and Goldfish will become corrupted.
 * Zombies and Possessed Armors start breaking down doors.
 * The Groom, which 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.
 * All water not being affected by fountains in the world will turn red.
 * The Eerie music plays instead of the regular night music in most surface biomes.
 * All female NPC's (except the Party Girl) become rather angry or irritated.

Special Moon Events
The Pumpkin Moon and the Frost Moon are two special types of moon events which do not behave like the other moon phases. Rather than being triggered at random or according to a cycle, they are activated by the player by using their corresponding summoning items, the Pumpkin Moon Medallion and the Naughty Present, respectively. The moon phase of these events correlates exactly with the phase of the moon before the summoning item was activated, and does not interrupt the moon cycle. These moon events will also behave according to their moon phase, and allow the purchase of phase-dependent items from NPC's.