Leyline of the Void reads: 'If a card would be put into an opponent's graveyard from anywhere, exile it instead.' The word 'anywhere' is the key — it covers all zones, including the stack (CR 400.1 lists all zones: library, hand, battlefield, graveyard, stack, exile, and command zone).
When a spell is countered, it moves from the stack to its owner's graveyard as part of the resolution of the counter effect (CR 608.2b, CR 700.4). Leyline of the Void sets up a replacement effect (CR 614.1) that intercepts that movement and redirects the card to exile instead of the graveyard.
This replacement effect applies to cards, not to tokens. Tokens that would be put into a graveyard are simply removed from the game instead (CR 111.8), so they are unaffected by Leyline in a meaningful way — but any actual card countered off the stack is exiled by the Leyline.
Concrete example: Your opponent casts Counterspell targeting your creature spell. Normally your creature card goes to your graveyard. With Leyline of the Void on the battlefield (controlled by your opponent), the card is exiled instead — you cannot retrieve it with graveyard recursion.
Note that Leyline only affects opponents' cards, not your own. If you control the Leyline, your own countered spells still go to your own graveyard normally (CR 614.1).
Unofficial fan resource — not affiliated with or endorsed by Wizards of the Coast. Answers are AI-generated estimates grounded in the Comprehensive Rules and are not a substitute for an official judge. Verify anything match-critical.