Excel Column ↔ Number Converter

Convert Excel column letters (A, AB, ZZZ) to column numbers

Ad placeholder (leaderboard)

Why Excel columns are not ordinary base-26

Spreadsheet column labels look like base-26, but they use a quirk called bijective numeration. There is no digit for zero: the symbols run A through Z (values 1 through 26), so after Z comes AA rather than BA. That single difference is why naive base-26 conversion gives the wrong answer for multi-letter columns.

How it works

To turn letters into a number, scan left to right and accumulate:

total = total * 26 + (letterValue)   where A=1 … Z=26

So AB is 1 * 26 + 2 = 28, and ZZ is 26 * 26 + 26 = 702.

To turn a number back into letters, peel off one letter at a time from the right, subtracting one before each step to account for the missing zero:

n = n - 1
letter = 'A' + (n mod 26)
n = floor(n / 26)

Repeat until n reaches zero, then reverse the collected letters. This converter implements exactly that algorithm, so it round-trips perfectly with Excel and Google Sheets.

Example and tips

Column index 16384 returns XFD, the last column in a modern Excel sheet. Going the other way, the label AAA works out to 1×676 + 1×26 + 1 = 703. Because the math is purely positional, the tool handles arbitrarily long labels, which is handy for generating CSV headers or validating data-export pipelines.

Ad placeholder (rectangle)