The Terra Blade is a post-Plantera sword crafted from the True Night's Edge, the True Excalibur and a Broken Hero Sword. Every step of the recipe tree, from the Night's Edge to the final craft.
The Terra Blade is a Hardmode sword in Terraria that you craft from the True Night's Edge, the True Excalibur and a Broken Hero Sword at a Mythril or Orichalcum Anvil. Since the Broken Hero Sword only drops from Mothron, you can finish it only after you beat Plantera.
The full chain has eight swords before the Terra Blade itself, with materials from almost every part of the game, from the Underworld to the Jungle Temple. This guide goes through the whole chain in the order you will usually get it.

Terra Blade stats:
The Terra Blade has three parts, and each of them is an upgraded sword of its own:

Broken down to raw materials, you need 30 Demonite or Crimtane Ore, 15 Jungle Spores, 12 Stingers, 3 Vines, a Muramasa, 60 Hellstone, 20 Obsidian, 12 Hallowed Bars, 20 of each mechanical boss soul, 120 Chlorophyte Ore and one Broken Hero Sword.
Gather the parts as you progress, not all at once at the end. The Night's Edge can be done before Hardmode, the two true swords right after the mechanical bosses, and only the Broken Hero Sword has to wait for Plantera.
The Night's Edge combines four pre-Hardmode swords at a Demon Altar or Crimson Altar: the Light's Bane or Blood Butcherer, the Blade of Grass, the Muramasa and the Volcano. The Muramasa is a 1 in 7 find in the locked Gold Chests of the Dungeon, so you need to beat Skeletron first. For every way to find it, see How To Get The Muramasa.

Every one of the four swords and where its materials come from is covered in How To Get The Night's Edge.
In Hardmode, take the Night's Edge to a Mythril or Orichalcum Anvil with 20 Souls of Sight, 20 Souls of Might and 20 Souls of Fright. Each soul comes from one mechanical boss:

Each boss drops 25 to 40 of its soul, so one kill of each gives enough for the sword, as long as you don't spend them on other gear first. The souls also go into the Pickaxe Axe or Drax, which you need for Chlorophyte in step 4. For the three fights, see How To Summon The Twins, How To Summon The Destroyer and How To Summon Skeletron Prime.
The True Night's Edge deals 70 damage and fires a spinning green blade that hits up to 3 times for half the sword's damage.
The Excalibur is 12 Hallowed Bars at a Mythril or Orichalcum Anvil. Every mechanical boss drops 15 to 30 Hallowed Bars (20 to 35 from its Treasure Bag in Expert), so one kill is enough.
It deals 72 damage and swings a large yellow aura that reaches about twice as far as the blade and hits up to 3 enemies.

The True Excalibur needs the Excalibur and 24 Chlorophyte Bars at a Mythril or Orichalcum Anvil. That is 120 Chlorophyte Ore, since each bar takes 5 ore at an Adamantite or Titanium Forge.
Chlorophyte Ore is the bright green ore in the mud of the Underground Jungle. You need a pickaxe with at least 200% pickaxe power to mine it, such as the Pickaxe Axe or the Drax, both made with souls from the mechanical bosses.

Note: Chlorophyte slowly spreads to nearby mud underground. If you can't find enough, mine what you can, leave some ore behind, and come back later.
The True Excalibur keeps 72 damage, but swings faster and its aura hits up to 6 enemies at once.
The Broken Hero Sword only drops from Mothron, a rare enemy of the Solar Eclipse that appears after Plantera. It drops the sword with a 25% chance (43.75% in Expert and Master Mode), and Mothron itself only has a 1 in 80 chance per eclipse spawn, so this step usually takes the longest. For the boss that comes first, see How To Summon Plantera.

Solar Tablets from the Jungle Temple start an eclipse whenever you want. How to farm them, raise Mothron's spawns and beat it is in How To Get The Broken Hero Sword.
With the True Night's Edge, the True Excalibur and the Broken Hero Sword in your inventory, open the crafting menu next to a Mythril or Orichalcum Anvil and craft the Terra Blade. Making it also unlocks the "Sword of the Hero" achievement.
Reforge it at the Goblin Tinkerer until it gets the Legendary modifier. It is the best modifier the sword can get, and it improves both the swing and the projectile.
The swing and the projectile both do damage, so it works at close and long range. The projectile loses 25% of its current damage for each enemy it passes through and disappears after 1.5 seconds or when it hits a block.

Note: Don't sell it later. The Terra Blade is one of the ten swords that go into the Zenith, the strongest melee weapon in the game.