Convert coordinates between the Overworld and Nether
1 Nether block = 8 Overworld blocks
Divide your Overworld X and Z by 8 to get the matching Nether spot. Height (Y) stays the same and is never divided. When you step through a portal, the game looks for the nearest existing portal nearby. It searches 16 blocks around you in the Nether, or 128 blocks in the Overworld.
Build your Nether-side portal at the exact coordinates this calculator gives you. If you're even a few blocks off, the game might connect you to a completely different portal instead.