The excel autofit shortcut for column width is Alt, H, O, I, pressed one after another. Highlight the columns beforehand, or everything via Ctrl + A, and Excel makes every column just wide enough for its longest entry.
For rows, end with A instead of I. With the mouse, double clicking the line between two column letters does the same thing for that column.
Quick facts
Column width
Alt, then H, then O, then IRow height
Alt, then H, then O, then AExact column width
Alt, then H, then O, then WExact row height
Alt, then H, then O, then HWhole sheet
Ctrl + A firstMouse
Double click the border
Excel autofit shortcut keys
| Action | Keys |
|---|---|
| AutoFit column width | Alt, then H, then O, then I |
| AutoFit row height | Alt, then H, then O, then A |
| Type an exact column width | Alt, then H, then O, then W |
| Type an exact row height | Alt, then H, then O, then H |
| Set the default width for the sheet | Alt, then H, then O, then D |
Press each key separately. After Alt, small letters appear on the ribbon and guide the next press.
How to auto adjust column width in Excel with the shortcut
- Pick a cell inside the column; for a group of columns, press Ctrl + Space then stretch the selection with Shift + Right.
- Tap Alt, H, O and finally I.
- The columns resize to fit their longest content.
To fit every column at once, press Ctrl + A (twice if you are inside a table) before the keys. This is the fastest way to tidy a sheet exported from billing software, where all columns arrive the same width.
Fix ##### in Excel cells
When a column is too narrow for a number or date, Excel shows ##### instead of the value. The data is fine; it just does not fit. AutoFit the column and the value appears. Text behaves differently: it spills into the next empty cell, or gets cut off if the next cell has data.
Row height in Excel shortcut and wrapped text
Rows normally grow by themselves when you wrap text. If a row stays too short or too tall after editing, select it and press Alt, H, O, A. Rows with merged cells are the exception: AutoFit ignores them, so set their height by hand with Alt, H, O, H. The wrap text shortcut explains wrapping.
When AutoFit does not work
| Problem | Fix |
|---|---|
| Column barely changes | A long hidden entry far down is setting the width; check with Ctrl + Down |
| Row height does not fit | Merged cells in the row; set the height by hand |
| Keys do nothing | You are editing a cell; press Esc first |
| Sheet is protected | Formatting columns may be locked; unprotect it |
Frequently asked questions
What is the autofit shortcut in Excel?
How do I adjust column width in Excel with the keyboard?
AutoFit with Alt, H, O, I, or type a width after Alt, H, O, W.
How do I autofit all columns at once?
Select the whole sheet with Ctrl + A, then use the AutoFit keys.
What is the row height shortcut in Excel?
Why does my cell show #####?
The column is too narrow for the number or date. AutoFit it.
Can I double click to autofit?
Yes, double click the line on the right of the column letter.