How Nether portal linking works

Portals in Minecraft aren't paired. Each time you step through, the game works out where you should arrive and grabs the nearest portal it can find there. Once you know the rules, broken links are easy to fix.

What happens when you step through

  1. Your position is converted. Going to the Nether, X and Z are divided by 8 and rounded down. Going to the Overworld, they are multiplied by 8. Y stays the same.
  2. The game searches around that point. It checks a square area centred on the converted position, through the full height of the world.
  3. The closest portal wins. Distance is a straight line in three dimensions, so height counts as much as X and Z. In Java, a tie goes to the lower portal.
  4. If nothing is in range, a new portal is built. The game looks for a flat, open spot within 16 blocks of the converted position, at any height.

Search areas in Java and Bedrock

Java EditionBedrock Edition
Arriving in the Nether16 blocks each way128 blocks each way
Arriving in the Overworld128 blocks each way128 blocks each way
Height searchedWhole worldWhole world
Closest portal measuredStraight line, X Y ZStraight line, X Y Z
Nether search areas: Java's small 33 by 33 square sits inside Bedrock's 257 by 257 square. A portal 40 blocks away is found by Bedrock but not by Java. Bedrock: 128 blocks each way Java: 16 each way arrival point Nether portal 40 blocks east Drawn to scale, in Nether blocks.
Arriving in the Nether. Bedrock finds the portal 40 blocks away and sends you there. Java ignores it and builds a new portal near the arrival point.

Java's small Nether search was added in Java 1.16.2. Before that it also searched 128 blocks, so older guides that say "128 both ways" describe the old behaviour.

Why one-way links happen

Say you have a base portal and its Nether partner, and they link fine. Then you build a second Overworld portal at a farm about 80 blocks away and light it.

The farm portal leads to the base's Nether portal, but that Nether portal leads back to the base, not the farm. Overworld Nether Base Farm Base's Nether portal two-way farm lands here
The farm's converted point is only 10 Nether blocks from the base's Nether portal. That is inside Java's 16-block search, so the game uses it. Coming back, the base is closer, so you never return to the farm.

The farm portal goes into the Nether fine, but the trip back always ends at the base. Add both Overworld portals and the Nether portal to the link checker and it flags the farm as one-way, with the spot for its own Nether portal.

How to fix a portal that links to the wrong place

  1. Stand in the bottom block of the portal that goes wrong and note its coordinates. In Java, F3 shows them on the "Block" line.
  2. Put those numbers in the calculator to get the exact spot for its partner.
  3. Travel there in the other dimension and build the partner portal on that exact block, at the same Y if you can.
  4. If the game made an extra portal you don't want, break one of its obsidian blocks so it stops counting.
  5. Walk through both ways to test. If it still goes wrong, check the list for another portal that is closer, including one far above or below you.

How close can two portals be?

There is no fixed safe distance. What matters is whether each portal is the closest one to its partner's converted point. If you build both sides of every pair at exact converted coordinates, pairs a few dozen Overworld blocks apart still link correctly, because each portal sits right on its partner's arrival point.

Problems start when one side is placed by eye or built by the game. Then a neighbour can be closer. Bedrock's 128-block Nether search makes this far more likely than in Java.

Other portal numbers worth knowing

Smallest frame4 × 5 (2 × 3 opening)
Largest frame23 × 23
Obsidian for the smallest portal10 without corners, 14 with
Time to stand in a portal4 seconds in Survival
Game-built portal search16 blocks around the arrival point
Overworld to Nether scale8 : 1 for X and Z

Questions

Do Nether portals have to be built in the same direction to link?

No. A portal facing north to south can link to one facing east to west. Only the position counts.

Can two Overworld portals share one Nether portal?

Yes. Both lead into it, but it only leads back to whichever Overworld portal is closer to its converted point. The other one becomes a one-way link.

Why did the game build a portal in the air or in lava?

No existing portal was in range and it couldn't find a good open spot within 16 blocks, so it placed one anyway. Build the partner yourself at the exact converted spot to avoid it.

Does Y matter for portal linking?

Yes. Y is not divided by 8, and the closest portal is measured with height included. A portal far above or below your arrival point can lose to one that is further away on the map.