Your files stay on your device

# Morton code calculator

Interleave the bits of two 16-bit coordinates into a Morton code, or decode a code back to x and y, with the binary interleaving shown.

Enter x and y to interleave them.

The Z-order curve interleaves bits so that nearby coordinates land in nearby codes, which is why spatial indexes and geohash-style tiles use it. The property is one-directional in practice: points that are close in space get close codes, but close codes can also come from distant points across a Z boundary, so equal codes never mean equal neighbors. This page does plain bit math in one direction at a time, in this tab, with nothing fetched.
Options

## More regex & cron tools

- [Base64](/encoding/base64)
- [UUID generator](/generate/uuid-generator)
[All regex & cron tools](/dev)

Was this tool useful?
YesNo

---

Canonical HTML: https://nutter.tools/dev/z-order-morton-code-calculator
Markdown version: https://nutter.tools/dev/z-order-morton-code-calculator.md
Plain-text version: https://nutter.tools/dev/z-order-morton-code-calculator.txt
Agent index: https://nutter.tools/llms.txt

