X spells
Core concepts
Spells where you choose X as you cast — and X is 0 everywhere else.
How it works
When you cast a spell with {X} in its cost, you choose the value of X as part of casting it, then pay that much. While the spell is on the stack, its mana value counts X as the chosen number.
Anywhere other than the stack — in your hand, graveyard, library, or exile — X is treated as 0.
Common confusions
“What's the mana value of an X spell in my graveyard?”
X is 0 there, so a card like a {X}{R} spell has mana value 1 in any zone except the stack.
“Copying an X spell.”
A copy uses the same chosen value of X as the original — you don't (and can't) pick a new X for the copy unless an effect says so.
“Changing X after casting.”
You can't. X is locked in when you cast (or activate) the spell or ability; later cost reductions don't let you raise it.