How to AutoFit Column Width and Row Height in Excel
By ExcelReady TeamUpdated 4 min read
The short answer
To AutoFit column width in Excel, double-click the right border of the column letter. Excel resizes the column to fit its longest entry. For several columns, select them first and double-click any one border. On Windows, Alt, H, O, I does the same from the keyboard, and Alt, H, O, A fits the row height.
Key takeaways
- Double-click the right border of a column letter to AutoFit it; select several columns to fit them all at once.
- Windows keys: Alt, H, O, I for column width and Alt, H, O, A for row height.
- AutoFit fits the selection: select one cell first to ignore a long title above the data.
- Merged cells and long titles are the usual reasons AutoFit looks wrong.
in a cell means the column is too narrow for the number or date; AutoFit fixes it.
On this page+
- How to AutoFit column width with the mouse
- How to AutoFit from the ribbon and keyboard
- How to AutoFit all columns at once
- How AutoFit treats your selection
- How to set an exact column width or row height
- Why is AutoFit not working?
- AutoFit in Excel Tables and filtered lists
- Tidy layouts make sheets easier to read
- Practise it
To AutoFit column width in Excel, double-click the right border of the column letter, and the column resizes to fit its longest entry. AutoFit works for row height too, and it can fix a whole sheet at once. This guide shows the mouse, ribbon and keyboard methods for Windows and Mac, how to set an exact width, and what to do when AutoFit gives a strange result.
How to AutoFit column width with the mouse#
The quickest way is a double-click on the column border.
- Move the pointer to the column letters at the top of the grid.
- Point at the right border of the column you want to fit, for example the line between A and B. The pointer turns into a double arrow.
- Double-click. Column A now fits its widest cell.
To fit several columns at once, select them first. Click the letter A, hold Shift and click D, then double-click the border of any selected column. Each column fits its own content, so they don't all end up the same width. The guide to selecting an entire column or row shows the keyboard ways to select.
How to AutoFit from the ribbon and keyboard#
The ribbon does the same thing and is easier to reach from the keyboard.
| Task | Windows | Mac |
|---|---|---|
| AutoFit column width | Alt, H, O, I | Format > Column > AutoFit Selection |
| AutoFit row height | Alt, H, O, A | Format > Row > AutoFit |
| Set an exact column width | Alt, H, O, W | Format > Column > Width |
| Set an exact row height | Alt, H, O, H | Format > Row > Height |
On Windows, the commands are under Home > Format in the Cells group. The key sequence is not held down: press and release Alt, then H, then O, then I. On a Mac, the Format menu is in the menu bar at the top of the screen.
How to AutoFit all columns at once#
To fit every column on the sheet, select the whole sheet first.
- Click the Select All triangle in the top-left corner, above row 1 and left of column A. Or press Ctrl+A (⌘A on a Mac); if your cursor is inside data, press it twice.
- Double-click any column border.
Every used column now fits its content. You can double-click any row border at the same moment to fit all rows. This is a good last step before you send a file or finish a test task, because cut-off text and #### look careless.
How AutoFit treats your selection#
AutoFit fits the selected cells, not always the whole column. That detail is useful.
Say A1 holds a long report title, "Quarterly Sales Report for the North Region", and the product names below are short. Double-clicking the border makes column A as wide as the title, which looks odd. Instead:
- Select only the data cells, for example A2:A20.
- Choose Home > Format > AutoFit Column Width (Alt, H, O, I).
The column now fits the product names and ignores the title, which simply spills over the empty cells to its right. The double-click method always uses the whole column, so use the ribbon for this trick.
How to set an exact column width or row height#
Sometimes you want columns to match, not to fit. Select the columns, then choose Home > Format > Column Width and type a number.
- Column width is measured in characters of the default font. A new sheet starts at about 8.43, and the maximum is 255.
- Row height is measured in points. The maximum is 409.
To copy widths from one area to another, copy the source columns, select the target, then use Paste Special > Column widths. To change the standard width for every column you haven't resized, use Home > Format > Default Width.
Why is AutoFit not working?#
AutoFit fails or looks wrong for a few common reasons.
- Merged cells. AutoFit ignores merged cells completely. Unmerge them, or set the width by hand.
- A long title or note in the column. The column becomes huge. Use the selection trick above.
- Wrapped text. With Wrap Text on, AutoFit Column Width may not widen the column, because the text already fits on several lines. AutoFit the row height instead.
- Protected sheet. If formatting columns is blocked, the commands are greyed out.
- Values that change later. Column AutoFit is a one-time action. If a formula later returns a longer result, AutoFit again.
If a number or date shows as ####, the column is too narrow to display it. AutoFit fixes this in one double-click. The value itself is fine, as the guide to formatting numbers as currency and percent explains, since formatting can make a number wider.
AutoFit in Excel Tables and filtered lists#
AutoFit works the same way inside an Excel Table. One extra tip: header cells in a table show a filter arrow, which takes up room. If a header looks cut off after AutoFit, widen the column a little by hand so the arrow doesn't cover the text.
In a filtered list, AutoFit only measures the rows you can see. When you clear the filter later, a longer hidden entry may not fit, so AutoFit again after you clear filters.
Tidy layouts make sheets easier to read#
AutoFit is one part of a clean sheet. Add borders to separate headers and totals (see how to add borders in Excel), freeze the header row, and keep each column to one kind of data. If you are new to cell addresses like B3 and ranges like A2:A20, the guide to Excel cell references is a good place to start.
Practise it#
Layout skills come quickly with a bit of hands-on time. Open the Cells, rows and columns lesson to practise finding, selecting and typing into cells in a live spreadsheet. Then try the formatting shortcuts lesson to bold headers and apply currency and percent formats from the keyboard. Each step is checked instantly.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
AutoFit sizes a column to its longest entry. Find how many characters the longest product name has: click C2, type =MAX(LEN(A2:A6)) and press Enter. (In Excel 2019 or earlier, press Ctrl+Shift+Enter instead.)
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Longest name | |||
| 2 | ||||
| 3 | ||||
| 4 | ||||
| 5 | ||||
| 6 | ||||
| 7 | ||||
| 8 | ||||
| 9 |
Tip: LEN counts the characters in each name and MAX returns the biggest count.
Practise this in a lesson
Frequently asked questions
What is the shortcut to AutoFit column width in Excel?
On Windows, select the column and press Alt, then H, then O, then I, one key after the other. On a Mac, use Format > Column > AutoFit Selection, or double-click the column border.
How do I AutoFit all columns in Excel at once?
Click the Select All triangle above row 1, or press Ctrl+A (⌘A on a Mac) until the whole sheet is selected, then double-click any column border. Every column fits its own content.
Why is AutoFit not working in Excel?
The usual causes are merged cells, which AutoFit ignores, and a long title that makes the column far too wide. AutoFit also won't run on a protected sheet that blocks formatting.
How do I AutoFit row height in Excel?
Double-click the bottom border of the row number, or select the rows and choose Home > Format > AutoFit Row Height. On Windows, press Alt, H, O, A.
Does Excel AutoFit columns automatically?
Not after you type. Excel widens a column once when you enter a number, but it won't keep resizing as text changes. Rows do resize automatically unless you set their height by hand.