Excel Column Letter to Number Converter

Instantly convert Excel column letters (A, AA, XFD) to column numbers and vice versa. Supports all 16,384 Excel columns.

Column Letter → Number

=
27

Column Number → Letter

=
AA

Quick Reference:

A=1
B=2
C=3
D=4
E=5
F=6
G=7
H=8
I=9
J=10
K=11
L=12
M=13
N=14
O=15
P=16
Q=17
R=18
S=19
T=20
U=21
V=22
W=23
X=24
Y=25
Z=26
AA=27
AZ=52
BA=53
ZZ=702
AAA=703
XFD=16384

Understanding Excel Column Letters

Microsoft Excel uses a bijective base-26 numeration system to label its columns. Unlike standard base-26 which includes a zero digit, Excel's system starts at 1 (A) and uses no zero placeholder. The first 26 columns are labeled A through Z. Column 27 is AA, column 28 is AB, and so on through AZ (52), then BA (53) through BZ (78), continuing until ZZ (702). After that, three-letter columns begin with AAA (703) and extend to the maximum column XFD (16,384).

This numbering system was inherited from VisiCalc, the first electronic spreadsheet program created by Dan Bricklin and Bob Frankston in 1979. The convention proved so intuitive — letters for columns, numbers for rows — that it was adopted by Lotus 1-2-3 and subsequently by Microsoft Excel, Google Sheets, LibreOffice Calc, and virtually every other spreadsheet application ever made.

The Bijective Base-26 Number System

The Excel column system is mathematically interesting because it is a bijective numeration — a positional number system that does not use a zero digit. In standard base-26, the digits would be 0-25, but Excel's system uses digits 1-26 (represented by A-Z). This creates a subtle but important difference in how multi-digit "numbers" are calculated.

To convert a column letter to its number, treat each letter as a digit with A=1 through Z=26, then compute: (first digit) x 26^(n-1) + (second digit) x 26^(n-2) + ... + (last digit) x 26^0. For "BA": B=2, A=1, so the column number is 2 x 26 + 1 = 53. For "AAA": A=1, A=1, A=1, so it is 1 x 676 + 1 x 26 + 1 = 703.

Converting Numbers to Column Letters

The reverse conversion — from a column number to its letter representation — requires a modified division algorithm. Instead of the standard modulo-26 operation, you must handle the case where the remainder is zero. When dividing by 26, a remainder of 0 corresponds to the letter Z (not a zero digit that does not exist in this system), and you must subtract 1 from the quotient before continuing the division.

function numToCol(n) {
let col = '';
while (n > 0) {
let rem = n % 26;
if (rem === 0) { rem = 26; n = Math.floor(n/26) - 1; }
else { n = Math.floor(n/26); }
col = String.fromCharCode(rem + 64) + col;
}
return col;
}

Practical Applications

Knowing how to convert between column letters and numbers is essential for spreadsheet power users. When writing formulas that reference columns dynamically — using functions like INDIRECT, OFFSET, INDEX, or MATCH — you often need to translate between the letter and numeric representations. VBA macros and Google Apps Script frequently use column numbers internally while displaying letters to users.

The conversion is also relevant in data engineering and ETL pipelines. When importing CSV files or building database schemas from spreadsheet data, column letters must be mapped to zero-based or one-based indices. Programmers working with libraries like openpyxl (Python), Apache POI (Java), or SheetJS (JavaScript) regularly need to convert between these representations.

Excel Column Limits Through History

The maximum number of columns has increased with each major Excel version. Excel 2003 and earlier supported 256 columns (A to IV). Excel 2007 expanded this dramatically to 16,384 columns (A to XFD) as part of the new .xlsx format. The row limit was simultaneously increased from 65,536 to 1,048,576. Google Sheets matches the 16,384-column limit. LibreOffice Calc supports up to 1,024 columns by default, though this can be configured.

Frequently Asked Questions

Related Tools