AutoFit column width shortcut in Excel
The keys
| Shortcut | Windows | Mac |
|---|---|---|
| Select the current region, then the whole sheetPress once for the block of data around the active cell, again to add its summary rows, and again for the whole sheet. | Ctrl+A or Ctrl+Shift+Space | Command+A or Command+Shift+Space |
| Select the entire column How to: Insert row shortcut in Excel On a Mac, Control+Space also switches input sources in macOS. If it does that, turn the macOS shortcut off in System Settings > Keyboard > Keyboard Shortcuts. | Ctrl+Space | Control+Space |
| Open Format Cells How to: Merge cells shortcut in Excel Every number, date, alignment, border and protection option in one dialog. | Ctrl+1 | Command+1 or Control+1 |
Checked against Microsoft's official lists on . Where Microsoft lists a key for one platform only, the other column says so instead of guessing.
Autofit every column at once
Press Ctrl+A until the whole sheet is selected (twice inside data), then Alt, H, O, I. Every column fits its widest entry. With the mouse, select all and double-click any column border.
To fit a column to one cell only, such as a heading, select just that cell and use the same keys: AutoFit then measures only the selection.
Why AutoFit ignores some cells
- Merged cells: AutoFit skips them entirely. Unmerge, or use Center Across Selection.
- A long title in row 1 makes the column too wide. Autofit the data rows only, then set the title to wrap or to span columns.
Set an exact width
On Windows, Alt, H, O, W opens Column Width so you can type a number, and Alt, H, O, H sets Row Height. On a Mac, use Format > Column > Width in the menu bar.
Why a shortcut sometimes does nothing
KeyTips change with the language
Alt sequences such as Alt+H, O, I are ribbon KeyTips: press Alt and the letters appear on screen. They come from the English ribbon. In another language, or when an add-in adds a tab, the letters can differ, so read them off the screen rather than memorizing them.
Related shortcuts
| Shortcut | Windows | Mac |
|---|---|---|
| Show the KeyTips (letters on every tab and button)Press and release, then type the letters that appear. Excel for the web on a Mac: Microsoft says to press Control+Option to start. | Alt or F10Web Alt+Windows key | —No Mac shortcut in Microsoft's list |
| Go to the Home tab | Alt+HWeb Alt+Windows key, H | —No Mac shortcut in Microsoft's list |
FAQ
What is the shortcut to autofit columns in Excel?
On Windows, select the columns and press Alt, H, O, I in turn. On a Mac, double-click the right edge of a column header; there is no keyboard shortcut.
How do I autofit row height?
Alt, H, O, A on Windows. On a Mac, double-click the bottom edge of the row header.
Why is my column showing ##### after autofit?
The value is wider than the column again, often because the number format or font changed after fitting. Autofit again, or see why Excel shows #####.
Related guides
- Excel showing ##### in a cell: why it happens and how to fix itWhen Excel shows ##### (a row of hashtags) instead of a number or date, the value does not fit in the cell.
- How to freeze panes in ExcelTo keep the header row visible, go to View > Freeze Panes > Freeze Top Row.
In the glossary: ##### (hash marks)Merged cellsWrap Text