Productivity and Utilities

Hex Grid Distance and Range Calculator

Pick a coordinate system and enter two hexes to get their distance and the line between them.

Your numbers

Offset names follow the layout: "r" systems have pointy tops and shift rows, "q" systems have flat tops and shift columns.

Column or q (or x for cube). Whole numbers; negative is fine.

Row or r (or y for cube).

A whole number from 0 to 1000.

Result

Distance

5 steps

From (0, 0) to (3, -5) in axial (q, r) coordinates.

Distance in steps
5
Hexes in the line, both ends included
6
Hexes within 2 of the first
19
Hexes exactly 2 away
12
Neighbors of the first hex
(1, 0) (1, -1) (0, -1) (-1, 0) (-1, 1) (0, 1)

Hexes on the line

StepHex
0(0, 0)
1(1, -1)
2(1, -2)
3(2, -3)
4(2, -4)
5(3, -5)

Both hexes in every system

SystemFirst hexSecond hex
Axial (q, r)(0, 0)(3, -5)
Offset odd-r(0, 0)(0, -5)
Offset even-r(0, 0)(1, -5)
Offset odd-q(0, 0)(3, -4)
Offset even-q(0, 0)(3, -3)
Cube (x, y, z)(0, 0, 0)(3, 2, -5)
How this was calculated
  1. Every system is first turned into cube coordinates (x, y, z with x + y + z = 0). Axial uses x = q and z = r. Offset layouts shift every other row or column, so they are converted by removing the shift.
  2. The distance is the largest of |dx|, |dy| and |dz| between the cube coordinates. The count of hexes within range n of a center is 3n(n + 1) + 1.
  3. The line is found by stepping evenly from one end to the other in cube space and rounding each point to the nearest hex.
  • Pointy-top and flat-top layouts use different offset rules, so pick the one that matches how your map is drawn. Where a line passes exactly along the edge between two hexes, either hex could be chosen, and games differ on which.

Calculated using SumPanda.com · https://sumpanda.com/hex-grid-distance-and-range-calculator/

Results are estimates for general information. Verify important figures before relying on them.

Next step

How to use the hex grid distance and range calculator

  1. Pick the coordinate system your map uses: axial, cube or one of four offset layouts.
  2. Enter the two numbers for the first hex, and the two numbers for the second hex. Cube coordinates take three numbers each.
  3. Set a range to count the hexes around the first hex.
  4. Read the distance, the hexes on the line between the two, and both hexes in every other system.

Formula

Cube coordinates (x, y, z) have x + y + z = 0; axial uses x = q and z = r

Distance = largest of |dx|, |dy| and |dz| between two hexes in cube coordinates

Hexes within range n of a center = 3 n (n + 1) + 1; hexes exactly n away = 6 n

Line: step evenly in cube space from one end to the other and round each point to a hex

Offset layouts (odd-r, even-r, odd-q, even-q) shift every other row or column. The page first removes the shift to get cube coordinates, then works there.

A distance of 5, and a range of 2

In axial coordinates, (0, 0) to (3, -5) is 5 steps. The line passes through (1, -1), (1, -2), (2, -3) and (2, -4). Within a range of 2 there are 19 hexes, 12 of them exactly 2 away. The same hexes in odd-r offset coordinates are (0, 0) and (0, -5).

On an odd-r offset map, (1, 1) to (5, 4) is 5 steps, and in cube coordinates (1, -3, 2) to (-2, 1, 1) is 4 steps, with 37 hexes within a range of 3.

Choosing a coordinate system

Axial and cube coordinates make distances and lines easy to compute, so they are common inside game code. Offset coordinates match how a map is drawn on a grid, with each row or column shifted by half a hex. A pointy-topped map shifts rows (odd-r or even-r), and a flat-topped map shifts columns (odd-q or even-q). If a count looks wrong, check that you picked the layout that matches your map.

For the odds of tabletop dice see the dice pool calculator and the hit, wound and save calculator. Regular shapes are in the regular polygon calculator, and printable maps in the hexagon grid paper generator.

Lines on a hex grid

A straight line across hexes is not unique when it runs exactly along the edge between two hexes. The page nudges the start slightly so that it always picks the same hex, but a game may use another rule. If your game defines the line differently, use the distance and the range, which do not depend on the choice.

Assumptions and limits

  • The grid is an unbounded plane of regular hexes, with no edges, walls or terrain costs.
  • Whole-number coordinates only, from -100,000 to 100,000, and a range from 0 to 1,000.
  • Cube coordinates must add to zero.
  • The line listing shows at most 200 hexes, though the distance is always exact.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

How do I find the distance between two hexes?

Convert both to cube coordinates and take the largest of the differences in x, y and z. The page converts from any system for you.

What is the difference between axial and offset coordinates?

Axial coordinates follow the hex directions, so the grid looks slanted. Offset coordinates shift every other row or column so that the map looks like a rectangle.

How many hexes are within a range of n?

There are 3n(n + 1) + 1, counting the center. A range of 2 has 19 hexes and a range of 3 has 37.

Which offset layout should I choose?

Use odd-r or even-r for pointy-top hexes and odd-q or even-q for flat-top hexes. The odd or even says which rows or columns are shifted.