Excel AutoFit: Resize Columns and Rows to Fit Their Contents
How to use Excel AutoFit for column width and row height: double-click, ribbon, keyboard shortcuts, VBA, and fixes for when AutoFit fails on merged or wrapped cells.
To AutoFit in Excel, select the columns you want to resize and double-click the right edge of any selected column heading, or go to Home > Cells > Format > AutoFit Column Width. For rows, use Home > Format > AutoFit Row Height, or double-click the bottom edge of a row heading.
That covers most cases. Below are the other ways to trigger AutoFit, how it behaves, and what to do when it refuses to cooperate, which usually comes down to merged or wrapped cells.
What AutoFit actually does
AutoFit sets a column’s width (or a row’s height) to the smallest size that shows the longest entry in it. It is a one-time resize, not a live setting. If you later type a longer value, the column won’t grow by itself; you run AutoFit again.
Row height is a little different. Excel adjusts row height automatically as you type in many situations, but as Ablebits notes, rows often don’t adjust when data is pasted or imported from another source. That is where AutoFit Row Height earns its place.
A few size facts from Microsoft’s column and row size page, as of October 2026:
| Setting | Column width | Row height |
|---|---|---|
| Unit | Characters (Normal style font) | Points |
| Default | 8.43 | Depends on font |
| Maximum | 255 | 409 points |
Because column width is measured in characters of the default font, a column AutoFitted on one machine can look slightly different if the workbook’s Normal style or fonts change.
Four ways to AutoFit columns and rows
1. Double-click the boundary (fastest)
- Select one or more columns by clicking or dragging across their letters.
- Hover over the right edge of any selected column heading until the cursor turns into a double-headed arrow.
- Double-click.
Every selected column resizes to fit its own content. The same works for rows: select row numbers, then double-click the bottom edge of any selected row heading.
To fit the whole sheet, click the Select All button (the triangle where the row and column headers meet), then double-click any boundary between two column headings. Microsoft lists this as the quick way to AutoFit all columns.
2. Use the ribbon
- Select the columns or rows.
- Go to Home, and in the Cells group click Format.
- Under Cell Size, choose AutoFit Column Width or AutoFit Row Height.
One useful detail: if you select a few cells rather than whole columns, AutoFit Column Width sizes the column to fit only the selected cells. That is handy when a long title in row 1 would otherwise make the column far too wide; select the data below it and AutoFit just that.
3. Keyboard shortcuts (Windows)
There is no single-key shortcut, but the ribbon key sequences work well once they are in your fingers. Press the keys one after another, not all at once:
- Alt, H, O, I = AutoFit Column Width
- Alt, H, O, A = AutoFit Row Height
These are the sequences listed by Ablebits and several other Excel guides. A few low-quality pages swap the letters around; the ones above match the ribbon’s access keys (H for Home, O for Format, then I or A).
Pair them with Ctrl+A to select the sheet first, or Ctrl+Space (whole column) and Shift+Space (whole row).
4. VBA, for repeat jobs
If you rebuild the same report every week, a macro saves clicks. Microsoft’s Range.AutoFit documentation gives the pattern:
Worksheets("Sheet1").Columns("A:I").AutoFit
To fit columns based on only some cells (for example, ignoring a long title row), Microsoft shows this form:
Worksheets("Sheet1").Range("A1:E1").Columns.AutoFit
Note the restriction from the docs: when you call AutoFit directly on a range, it must be an entire row or column (or a set of them), otherwise Excel raises an error. Using .Columns.AutoFit or .Rows.AutoFit on a smaller range is the way around that.
Excel for Mac and Excel for the web
On a Mac, double-clicking a column or row boundary works the same way as on Windows, and the Home tab has the same Format > AutoFit options. Third-party guides also describe a Format menu route in the macOS menu bar (Format > Column > AutoFit Selection), though menu names have shifted between versions, so check what your build shows. The Alt key sequences are a Windows feature; I couldn’t find an official default AutoFit keyboard shortcut for Mac.
For Excel for the web, double-clicking boundaries is the most dependable method. I didn’t find a current Microsoft page that documents the web version’s menu path separately, so if the ribbon looks different, look under Home > Format.
When AutoFit doesn’t work
Merged cells
This is the most common culprit. Microsoft states that you can’t use AutoFit on a column that contains a cell merged with cells in other columns, and its support article on wrapped text and row height describes the row-height version of the problem as by design.
Your options:
- Unmerge, then AutoFit. Select the cells, click Home > Merge & Center to unmerge, and run AutoFit again. If you merged cells only to center a heading, Center Across Selection (Format Cells > Alignment > Horizontal) gives a similar look without breaking AutoFit.
- Set the size by hand. Right-click the column or row heading, choose Column Width or Row Height, and type a value. Spreadsheet Planet recommends this when you need to keep the merge.
Wrapped text that still gets cut off
If a cell has Wrap Text on but the row stays one line tall:
- Run AutoFit Row Height on that row. Pasted or imported data is the usual reason it didn’t adjust on its own.
- Check whether someone set a fixed row height earlier. A manually set height can stop the row from adjusting, and running AutoFit Row Height resets it.
- Check the horizontal alignment. Troubleshooting guides point out that Fill alignment interferes with wrapping and AutoFit; switching to General or Left usually fixes it.
The column is way too wide
AutoFit fits the longest value in the selection, including headers, notes, or a stray pasted paragraph. Either select only the data range before using the ribbon command (method 2 above), or AutoFit and then drag the column narrower and turn on Wrap Text for the long cell.
Numbers show as
That means the column is too narrow for the number or date. AutoFit Column Width fixes it in one step.
Related tricks worth knowing
- Copy widths from another column. Copy a cell from the source column, right-click a cell in the target column, point to Paste Special, and choose Keep Source Column Widths, per Microsoft’s guide.
- Change the default width. On the Home tab, under Format > Cell Size, choose Default Width. To apply it to every sheet, right-click a sheet tab and pick Select All Sheets first.
- Re-run after refreshes. Since AutoFit is a one-off resize, data that changes often (pivot tables, query results) may need AutoFit again after each refresh, or a short macro that does it for you.
Menu labels and options can change with Microsoft 365 updates, so if something isn’t where this guide says it is as of October 2026, the Microsoft Support page linked above is the place to check first.
Free apps worth trying
SponsoredSponsored links. Installing through them can earn us a commission, at no cost to you. Apps are free to download; some offer optional in-app purchases.
Frequently asked questions
What is the keyboard shortcut for AutoFit in Excel? +
On Windows, select the cells and press Alt, H, O, I one after another to AutoFit column width, or Alt, H, O, A to AutoFit row height. These are ribbon key sequences, so you press the keys in order rather than holding them together.
Why does AutoFit not work on my merged cells? +
Microsoft documents that AutoFit cannot size a column or row based on a cell merged across several columns or rows. Either unmerge the cells and run AutoFit again, or set the width or height manually.
Can Excel AutoFit columns automatically as I type? +
Not for column width. Excel grows row height on its own for wrapped text in many cases, but column width only changes when you run AutoFit or resize it yourself, so you need to re-run AutoFit after your data changes.
How do I AutoFit every column on a sheet at once? +
Click the Select All button in the top-left corner of the grid (or press Ctrl+A), then double-click any boundary between two column headings. Microsoft lists this as the quick way to fit all columns on a worksheet.
Sources
- Change the column width and row height (Microsoft Support) (support.microsoft.com)
- Wrap text does not adjust row height in Excel (Microsoft Support) (support.microsoft.com)
- Range.AutoFit method (Excel) (Microsoft Learn) (learn.microsoft.com)
- How to AutoFit in Excel: adjust columns and rows to match data size (Ablebits) (ablebits.com)
- Excel Autofit Row Height Not Working – How to Fix (Spreadsheet Planet) (spreadsheetplanet.com)