Library

The library is one of the six main zones in Magic: the Gathering. 
==Description==
The library is the pile from which you draw cards, either the opening hand at the beginning of the game, during your draw phase, or because of an effect of a spell or ability. Cards drawn are put into a player's hand, from which they can be played. Some effects return cards to the top or bottom of your library, or cause cards to be shuffled into your library. Other effects allow you to search your library for a card; these effects can be referred to as "tutors".
Typically, whenever a player has looked through the contents of their library, that player shuffles the library before resuming play. This is to preserve the random order of the cards to be drawn and allow for luck to play a part in the game. In organized play, many judge policies concern preserving the randomness of the library when a player illicitly obtains knowledge of the order of a player's library.
The library also serves as an alternative win condition by being a finite resource. Once all of the cards in a library are drawn or otherwise removed, a player will lose the game if an effect causes them to draw a card. While most decks try to win by reducing life points, some aim at reducing another player's library to zero cards.
 
==Flavor==
Flavorfully speaking, the library represents a subset of all the spells the player (who is a planeswalker), knows. It is a subset because the player's entire Magic collection would be all the spells and lands they have encountered and learned in history.
==Rules==
==Rulings==
*If a player puts two or more cards on the top or bottom of another player's library (as with <c>Misinformation</c>), that player may arrange them in any order (unless otherwise specified) and doesn't reveal this order to the owner of the library.
==Mechanics dealing with the library==
===Putting cards on top of a library===
Putting cards on top of a library is primary in blue.
===Putting cards nth from the top of a library===
The delaying mechanic of putting cards nth from the top of a library is primary in white (e.g. <c>Approach of the Second Sun</c>)
===Playing cards off the top of your library, at a cost===
This effect isn't done very often. Any color can have access to it, but it must play cards from a subset that makes sense for that color. Blue is the color that can cast any card off the top. This effect is usually on a permanent that makes the top of your library be played face-up. You may then cast cards off the top of your library.
===Playing cards off the top of opponent's library===
Blue and black, being the sneaky colors, are the two that most often cast spells off the opponent's deck. Occasionally red does it, but usually, there's a short duration during which you can do it, unlike blue and black which usually don't have a time limit.
===Playing cards off the top of your library, for free===
Playing cards off the top of the library for free used to be in blue, but is now primary in red. This is because it has a chaotic feel (you don't know what's about to happen).
===Playing cards off the bottom of your library===
The card <c>River Song</c>, from the Universes Beyond set Doctor Who, is the first card that directs you to draw cards from the bottom of your library rather than the top.
===Restocking===
Putting cards from your graveyard back into your library ("Restocking") is primarily in green and blue. Green does it most as a "cycle of life" flavor, while blue is flavored more as magical manipulation. Blue sometimes also shuffles your hand in as well and then draws you cards.
===Revealing===
 is the only card that refers to the number of a named card contained in an opponent's library, and also the only card that reveals an opponent's library. is the only card that reveals one's library, to prevent the opponent from failing to find the cards it searches for.
==Number of cards in libraries==
===Constructed (Including standard, historic, pioneer, modern, and vintage)===
Libraries in this format have a minimum of 60 cards, and no maximum (note that players playing paper Magic should keep their decks small enough so that they can shuffle it in two hands). A library and its sideboard together may not contain four or more copies of the same card unless otherwise specified, even if they are printed in different sets.
===Limited (Including draft, sealed and cube)===
Libraries in this format have a minimum of 40 cards.
===Commander/Singleton===
100 cards exactly. A library and its sideboard together may not contain two or more copies of the same card, even if they are printed in different sets. In a commander deck, one of the legendary creatures (or planeswalker if written) in the mainboard is your commander.
===Brawl===
A sixty-card commander library.
==Starting Library==
The Mystery Booster test card <c>Witty Demon</c> introduced the concept of a "Starting library". This should be interpreted as "starting deck," including cards that started the game in a zone other than your library (such as <c>Buried Ogre</c> or <c>Memory Bank</c>).
==References==