The 8:1 ratio
In Minecraft's Java and Bedrock editions, one block travelled in the Nether corresponds to eight blocks in the Overworld on the horizontal axes. Divide Overworld X and Z by eight to find the matching Nether coordinates, and multiply by eight to go the other way.
The Y axis is not scaled. Height maps one to one, which is why a portal's vertical position transfers directly and why Nether ceiling height limits where portals can exist.
The ratio is why the Nether is used for fast travel: a manageable journey through the Nether covers eight times the ground above. It also means small errors are magnified — being 10 blocks off in the Nether puts you 80 blocks away in the Overworld, which is enough to miss a base entirely.
How the game decides where you arrive
Travelling through a portal does not simply place you at the scaled coordinates. The game searches for an existing portal near the target position, and if it finds one within the search radius it links to that instead. If it finds none, it generates a new portal at a suitable location nearby.
This search behaviour is why portals link unpredictably. Two Overworld portals whose scaled Nether positions fall within the search area of the same Nether portal will both link to it, and travelling back sends you to whichever the game finds first. The result is the classic problem of two bases sharing one destination.
The reliable fix is to build both portals manually at exactly corresponding coordinates rather than letting the game generate them. Build the Overworld portal, calculate the Nether coordinates, travel through, and construct a portal precisely at the calculated position — then break any auto-generated portal the game created. Spacing linked pairs well apart in the Nether, beyond the search radius, prevents them capturing each other's traffic.
Practical portal building
A portal frame needs a minimum of ten obsidian blocks, with the corners optional, and can be built up to 23 by 23. Larger portals are purely cosmetic in terms of linking behaviour.
Because Y is unscaled, building the Nether-side portal at a convenient height and tunnelling to it is usually easier than matching the Overworld height exactly. Many players build a network along the Nether roof or at a consistent Y level, connecting portals with tunnels, which gives predictable travel and avoids navigating dangerous terrain.
Note that coordinate scaling and portal search behaviour have differed between versions and between Java and Bedrock editions, particularly in the search radius and in how new portals are placed. If portals behave unexpectedly, checking the behaviour for your specific version is worthwhile — and building both ends manually is the approach that works consistently regardless.