Bed

A bed is a block (actually two blocks) that has two main functions: They allow the player to sleep through the night and skip to the next dawn, and they reset the player's spawn point to within a few blocks of the bed. In multiplayer, all online players in the overworld must lie in a bed for the world to skip to dawn.

If a player's bed is destroyed or the bed is surrounded by solid blocks and the player dies when the player had set his spawnpoint there, a message is displayed saying Your home bed was missing or obstructed, and the player will respawn at the original spawn point. With this in mind, the player should know how to navigate to their base with the bed from the original spawn point, or keep their base near the original spawn point.

Crafting
Neither the color of the wool, nor the type of wood used has any effect on the bed's appearance. The only way to change the bed's colors is with a resource pack or a mod.

Placement
Beds, unlike typical blocks, take up two blocks of space. Placement requires at least this much space away from the player's facing direction. When placed, the foot will be placed on the block selected and will face toward the user. Two or more beds can be placed next to each other, effectively allowing double beds. Like certain other blocks, beds can not be placed on snow, ice, glowstone, glass, carpet or leaves. If you remove the blocks underneath the bed, the bed will not be removed, but will remain floating. To put a bed on glass you must use this trick to make the bed float, and after that place the glass underneath. The floating bed method allows bunk beds and placement on blocks you can't normally place them on.

Behavior
Beds are used by pressing the use item button looking at the bed during the night. They can also be used during thunderstorms but not during rain or snow. Attempting to use a bed at any other time will result in a "You can only sleep at night" message. The exact tick time span during which a bed may be used at night is between 12541 and 23458, inclusive.

In order for the bed to work the player must be able to stand next to the bed at the same level as it, on a type of block that a bed could be placed on. In other words: Obstruction will not occur if there's a solid block (the same restrictions apply as the bed itself) at the 'floor level' with 2 air, or transparent blocks above it, in one of the ten blocks that surround the bed. It doesn't matter if the bed itself has blocks above it.

If all sleeping requirements are met and the player enters a bed, the player will be positioned in the bed, in multiplayer you will be seen above the sheets, and the screen will slowly fade to black. During this time, the player can leave the bed by clicking the Leave Bed button. Once the player has entered the bed, the spawn point is set near the bed.

Sleeping only changes the time of day to sunrise; it does not speed up processes which take place over time such as the decay of dropped items, plant growth, and smelting. However, if it were raining or snowing, the weather will end when the player wakes up. If the player went to bed late in the night (after monsters spawned), they will be able to collect the drops from sunburnt undead, and easily kill off a few stragglers. Of course, there may also be creepers about, but those despawn faster than the items do. Sleeping during a thunderstorm can unleash a forest fire, by ending the rain that would have put out the flames from a lightning strike.

The bed is in no way tied to a player's spawn point - the game only checks for the presence of a bed at a player's spawn point when the respawn button is clicked from the death screen. The bed may be destroyed, replaced, reoriented, etc. and will still serve as a spawn point for players so long as it exists when the player tries to respawn. Attempting to respawn without a bed at the player's spawn coordinates will reset their spawn, even if the bed is later replaced.

Beds are 9/16th of a block high, one more pixel than half a block. This prevents you from walking onto the bed from one level below the bed without jumping, but allows you to walk up onto other blocks while on top of the bed.

Beds placed in the nether or the end will explode when the player tries to sleep, and set fire to surrounding blocks. When broken, the bed will drop as an item (entity), and can be picked up and placed again. This could be used for mining in the nether, but is extremely dangerous: The explosion is more powerful than TNT, and at point-blank range, it may well kill even a heavily-armored player. However, even a few blocks' distance is enough to preclude death. It is possible to detonate beds without killing oneself when wearing blast protection armor.

Multiplayer
To skip the night, all players in the overworld must be in bed at the same time. However, players in the nether or the end do not have to sleep for this to happen (there is no day/night cycle in either of these dimensions).

Players can also chat while in bed, and can leave the bed before the time-skip (thus blocking it for everyone).

Destroying a bed while another player is sleeping would cause the player to wake up, even when it was not caused by a player (for example: an explosion).

If you try to sleep in a bed occupied by another player, you will get the message This bed is occupied.

Sleep Interruption
In old versions of Minecraft, sleeping in a vulnerable bed would cause the player to wake up early with a skeleton, a zombie, or less commonly a spider teleported next to them (referred to as a nightmare). A bed was considered vulnerable if it was placed in an area that passing monsters could access, with a generous definition - merely placing beds next to external walls would also cause this. Only existing mobs that have already spawned could be teleported beside the bed, but it was a common misconception that the mobs were newly spawned, causing players to add excessive torches to no avail. Waking up to a nightmare did not properly adjust the player's spawn point, meaning that if they died, they would go to their previous spawn point. The misconceptions and counter-intuitive spawn-setting logic frustrated many players, leading to the change in bed mechanics in more recent Minecraft versions.

In recent and current versions of Minecraft, nightmares are gone, but you cannot sleep if a hostile mob is within 8 blocks of the bed horizontally (along each axis) and 5 blocks vertically. If a monster is nearby, even through a wall, the message You may not rest now, there are monsters nearby will be displayed and the player will not be able to sleep until the monsters leave or are killed.

Trivia

 * When walked on, beds make the sound of stone.
 * Although they are taller than slabs, they can be walked off when sneaking.
 * Beds cannot be destroyed by fire.
 * If the player falls from high enough to take damage, but right click on a bed before they hit the ground, they won't take fall damage.
 * This also happens with minecarts and boats.
 * If there is a solid block above a bed, the surface of the bed will become black, much as with slabs.
 * Beds have the widest varieties of different blocks that can be use to craft them. Any type of wool or wooden plank can be used to craft it.
 * If the language is set to Canadian English and the player tries to sleep during the day, you get a message that says Sorry, you can only sleep at night. On every other English setting, it will simply say You can only sleep at night. This is a joke on stereotypical Canadian politeness and constant apologizing.
 * The command can be used to get the foot of the bed. The command is . If you place a pressure plate next to this foot of the bed, and step on the pressure plate, the block will break but you will get a full bed back. Also, if you place two of these blocks together, they will act like a full bed, but appear like the bed has two feet (no longer possible in 1.7.2, although it can still be achieved with the  command).
 * You can put water on top of a bed and sleep as if you're floating or swimming.
 * The bed's explosion in the end and nether upon attempting to sleep is more powerful than that of TNT.
 * Because bed explosions cause fire, it is possible to activate a Nether Portal with a bed.
 * If the world is quit while sleeping, upon return the player will be awake beside the bed.
 * The player's avatar clips just slightly into the bed if they have something in their hand and their feet protrude off the edge.
 * Using the command while another player is sleeping will still teleport the sleeping player.
 * If you place a bed on ice, running over the bed acts like running over ice, similar to slabs.
 * Beds are not breakable in adventure mode.
 * Beds will blow up in any other dimension except the overworld. Even in mods by default.
 * When sleeping in the presence of mobs, the mobs will look at the spot where the player's head would be if they were standing on the bed.
 * If a player sleeps when a jukebox is playing, the sound's direction will not adjust to the player's change in orientation until they wake up.
 * In Pocket Edition, sleeping restores health.
 * In Pocket Edition, sleeping in a floating bed will cause you to clip through when you wake.
 * In Xbox 360 Edition, there is a glitch where you can push a player off a bed, and the player will still be sleeping, unaware of what happened.
 * There is also a glitch where you can move your head up and down. Other players can see this, but in first-person view, you can't.
 * If you sleep when the is turned off, you will fall asleep, but wake up at night.
 * The game cannot tell if you are indoors, so you cannot sleep when monsters are near, even when you are inside an enclosed, monster-proof structure.