Stronghold

A stronghold is a structure that occurs naturally underground in the Overworld, and is the only place where a player can find an end portal. Strongholds can be located by using an.

Generation


Strongholds primarily generate underground and prefer to generate in biomes above sea level but generate underwater if necessary. Strongholds may generate at bedrock level, cutting the bedrock.

Most parts of the stronghold can be overwritten by ravines, caves, mineshafts, fossils or dungeons; but it is rare for the end portal to be replaced, which would force a player to find one of the other strongholds, as a portal can be activated only with all 12 frame blocks present.

Bedrock Edition
$$, strongholds generate randomly throughout the world. There are up to 3 strongholds per a world and those always generate under a village. They appear to have no fixed set distance, unlike the most structures, which means that they can rarely overlap. A stronghold can generate in the ocean, given there is land nearby. If it has to, a stronghold could generate perfectly fine above ground, in caves, in ravines, and even in oceans. There appears to be an infinite amount of strongholds, even capable of generating in the Far Lands. Because Bedrock Edition appears to begin stronghold generation at a spiraling staircase, it is rare to find no portal room in the stronghold.

Java Edition
$$, all strongholds are located at random coordinates within rings, each ring with a certain radius from the origin – the point at x = 0, z = 0, not the world spawn. Strongholds also may extend further in or out of that area. The strongholds are generated at roughly equal angles from the center point of the world (for instance, each stronghold in a ring of 3 is in the region of 120 degrees from the others, measured from the origin). The game does not generate a stronghold partially above-ground, any portion above the sea level is replaced with air, leaving a cutaway. If a stronghold generates in an ocean, which it usually never does, it typically generates with a floating portal room. There are 128 strongholds in total.
 * The first ring has 3 strongholds within 1,408-2,688 blocks of the origin.
 * The second ring has 6 strongholds within 4,480-5,760 blocks of the origin.
 * The third ring has 10 strongholds within 7,552–8,832 blocks of the origin.
 * The fourth ring has 15 strongholds within 10,624–11,904 blocks of the origin.
 * The fifth ring has 21 strongholds within 13,696–14,976 blocks of the origin.
 * The sixth ring has 28 strongholds within 16,768–18,048 blocks of the origin.
 * The seventh ring has 36 strongholds within 19,840–21,120 blocks of the origin.
 * The eighth and outermost ring has 9 strongholds within 22,912–24,192 blocks of the origin.

Structure
Strongholds vary in size. They contain several doors and rooms made mostly of stone bricks (45%), mossy stone bricks (30%), cracked stone bricks (20%) and infested stone bricks (5%). Infested cracked stone bricks and infested mossy stone bricks do not generate, unless silverfish enter these blocks. Strongholds are lit by enough torches to provide visibility in most areas, though not enough to suppress mob spawns. Stairs that generate within these structures include stone brick and cobblestone stairs, but not their mossy variants.

In generated chest corridors and storerooms, dispersed chests containing a variety of loot can be found.

Rooms
Strongholds feature various types of main rooms. Each room has an entrance, which is either a plain 3×3 opening, a wall with a wooden door, a wall with an iron door (with buttons), or a 3×3 opening with a grate of iron bars along the top and sides. Rooms may have exits to other room pieces or dead-end "exits" into stone. Additional "passages" between rooms may exist if their generation overlaps or if the stronghold intersects a cave, mineshaft, or other structure. Sometimes, doors can be sealed off by stone bricks, resulting in "secret doors", usually occurring with 5-way crossings.

Stronghold generation begins with a spiral staircase room with a 5-way crossing at the bottom, with additional rooms being randomly generated from the exits of previous rooms up to a maximum distance of 50 rooms and 112 blocks horizontally. If a portal room is not generated, the generation is redone.


 * End portal room: Contains an end portal and a silverfish spawner. There are two pools of lava in the front sides of the room and a bigger lava pool below the end portal, and 16 windows of iron bars in the room, with the entrace always being a gate. In most cases, this room cannot be overwritten by other structures generated around it. Only one per stronghold, and it is never within 5 rooms of the starting staircase. Each portal frame has a 10% chance to generate containing an eye, the average number of portal frames found prefilled is 1.2. The chance of the portal being completely pre-filled is one in a trillion (1:1,000,000,000,000 or 10-12).
 * $$, all seeds for 1.16 that have a pre-activated end portal have been found.
 * $$, it is intended that some strongholds do not generate with end portal rooms.
 * Libraries (see below). 0-2 libraries per stronghold, and never within 4 rooms of the starting staircase.
 * Large rooms: A room with three exits (four counting the entrance). The center of the room may have various decorations. 0-6 rooms per stronghold.
 * Empty rooms: Has no decoration.
 * Stone Pillar rooms: Has a stone brick pillar with torches on it.
 * Fountain rooms: Contain a fountain in the center, which consists of a stone brick ring and pillar with a water source block on top of the pillar.
 * Storerooms: Dual-level rooms, each 2 blocks high, with a cobblestone center structure joining the two. A lone torch is housed within the structure. A ladder runs up the sidewall for access to the second floor, which is a chamber made of oak wood planks containing a chest.
 * Five-way crossing: Has up to five exits (six counting the entrance): one across from the entrance down a short stairway made of smooth stone slabs and stone brick blocks, one each to the left and right of the entrance, one on the left side of the upper level reached by a short stairway made of smooth stone slabs and stone brick blocks, and one on the right side of the upper level across a bridge of smooth stone slabs and double smooth stone slabs over the downward stair. A single torch is on the side of the bridge. $$, it usually has 1 to 4 entrances sealed. There is always one crossing in every stronghold as part of the starting point, while an extra 0-4 crossings may also generate.
 * Empty prison cells: A corridor with one wall partially made of iron bars and with two iron doors (in an "open" position, with no buttons). Beyond each iron door are cells with an iron bar wall between them. An exit is opposite the entrance. 0-5 rooms per stronghold. $$, no iron doors are generated.
 * Spiral staircase: A 3×3 spiral stair made of stone bricks and stone brick slabs, leading down, with an exit at the bottom. Like 5-way crossings, there is always one flight per stronghold as part of the starting point, while an additional 0-5 flights may also generate.
 * Straight staircase: A 3 block wide staircase of cobblestone stairs leading downward, with an exit at the bottom of the stairs. There is also an empty alcove under the stairs. 0-5 flights per stronghold.
 * Corridor: A bare corridor with up to 3 exits: one straight ahead, and optional exits to the left and right.
 * Chest corridor: A corridor with a small altar made of stone brick slabs, with a chest on the altar. An exit is on the opposite side of the entrance. 0-4 corridors per stronghold.
 * Corridor turn: A bare corridor with one exit, left or right. May resemble a small room if both the entrance and the next room's entrance have oak doors.
 * Dead-end corridor: A bare corridor with no exits, although it is likely to intersect other rooms. This room type never has a door or grate at the entrance.

Libraries
Libraries occur in two sizes: Small single-level libraries, and larger duplex libraries. All libraries contain bookshelves, oak planks, and one (single level) or two (duplex) chests, with cobwebs dispersed randomly.

Large libraries contain a second level consisting of a surrounding balcony with oak fences as railings, and fences & torches arranged like a chandelier over the center of the room. The two levels are connected by a ladder on the wall furthest from the entrance. No cobwebs generate here.

Trivia

 * There are exactly 233 bookshelves in a large library, yielding 699 books if mined without Silk Touch.
 * Although strongholds do not generate above ground, they can be exposed through above-ground dungeons or ravines.
 * They can also sometimes be exposed underwater if they generate in terrain that is close to an ocean, or exposed by an underwater ravine.
 * The only variant of infested blocks that can naturally generate within strongholds are regular stone bricks. Mossy and cracked variants cannot generate as infested blocks naturally.
 * When generating in a buffet world, many rooms lack the outer wall layer, causing the stronghold to appear fragmented, with the exception of the portal room.