How to Autofit in Excel: Step-by-Step Guide
In this article
To autofit in Excel, select the column or row you want to resize, then double-click the boundary line between column headers (or row headers) on the edge nearest the content. Excel instantly resizes the column or row to fit the longest entry. For a whole sheet, press Ctrl+A to select all cells, then double-click any column boundary. You can also use the ribbon: Home > Format > AutoFit Column Width or AutoFit Row Height. The steps below cover both methods, plus the common mistakes that stop autofit from working.
What You'll Need
- Microsoft Excel on Windows or Mac (the steps apply to Excel 2016 and later, including Microsoft 365; menu labels can differ slightly by version, device and region).
- A spreadsheet with at least one column or row containing text or numbers that are cut off or overflowing.
Step-by-Step
- Open your workbook and locate the column or row that needs resizing. If the content is cut off (showing ### for numbers or truncated text), that is the one to fix.
- Select the target. Click the column letter at the top of the sheet to select the entire column, or click the row number on the left to select the entire row. To autofit several columns at once, click the first column letter, hold Shift, and click the last one. To select the whole sheet, press Ctrl+A (Windows) or Command+A (Mac).
- Use the double-click method (fastest). Move the mouse pointer to the right edge of the selected column header until the cursor changes to a double-headed arrow, then double-click. For rows, double-click the bottom edge of the row header. Excel resizes to fit the widest or tallest entry in that column or row.
- Or use the ribbon. With the column or row still selected, go to Home > Format (in the Cells group). Choose AutoFit Column Width or AutoFit Row Height. The label may appear as AutoFit Column Width and AutoFit Row Height depending on your Excel version.
- Check the result. The column should now show the full text or number without cutting it off. If it still looks wrong, see Troubleshooting below.
- Repeat for other columns or rows as needed. If you selected multiple columns in step 2, one double-click resizes all of them at once.
Common Mistakes
- Double-clicking the wrong edge. You must double-click the boundary line between two column headers, not inside the header itself. The cursor must change to a double-headed arrow before you click.
- Resizing only one cell. Autofit works on whole columns and rows, not individual cells. If you select a single cell and double-click, Excel may still resize the whole column, but selecting the column header is more reliable.
- Forgetting merged cells. Autofit does not work on columns that contain merged cells. Excel cannot calculate the needed width, so it leaves the column unchanged. Unmerge the cells first (Home > Merge & Center > Unmerge Cells), autofit, then remerge if needed.
- Expecting wrapped text to autofit height automatically. If Wrap Text is on, row height may not adjust until you use AutoFit Row Height or double-click the row boundary. Turning on Wrap Text alone does not always expand the row.
- Using autofit on a protected sheet. If the worksheet is protected, resizing is disabled. You must unprotect the sheet (Review > Unprotect Sheet) before autofitting.
Tips
- To autofit every column in a sheet at once, click the Select All button (the small triangle at the top-left corner where the row and column headers meet), then double-click any column boundary.
- Autofit sets the column width to the longest visible entry. If a cell contains a long formula result or text, the column may become very wide. Consider turning on Wrap Text (Home > Wrap Text) and then using AutoFit Row Height instead.
- You can also set a specific width by right-clicking the column header and choosing Column Width, then typing a number. This is useful when you want consistent widths across a report.
- Keyboard shortcut: select the column, then press Alt+H, then O, then I (Windows) to autofit column width. On Mac, use the Format menu.
- Autofit does not change the font size or cell formatting; it only adjusts the column width or row height.
Troubleshooting
- Nothing happens when you double-click. Make sure you are on the boundary line between headers, not inside a cell. Also check that the sheet is not protected (Review tab > Unprotect Sheet).
- The column still cuts off text. The column may contain merged cells or a hidden character. Select the column, check for merged cells (they appear as one wide header), and unmerge if needed. Then try AutoFit Column Width from the ribbon.
- Row height will not shrink. If you manually set a row height earlier, autofit may not override it. Select the row, go to Home > Format > Row Height, and set it to a smaller number, or use AutoFit Row Height again.
- Autofit makes columns too wide. A single long entry (like a URL or a long note) forces the width. Shorten the entry, enable Wrap Text, or set a fixed width manually.
- The Format button is greyed out. The workbook may be in a mode that restricts changes, such as when a cell is being edited or the sheet is protected. Press Esc to exit edit mode, then try again.
Frequently Asked Questions
Does autofit work on merged cells?
No. Excel cannot autofit a column that contains merged cells. You must unmerge the cells first, autofit the column, and then remerge if you still need them merged.
How do I autofit all columns at once?
Click the Select All button (the triangle at the top-left corner of the sheet), then double-click any column boundary. Alternatively, go to Home > Format > AutoFit Column Width.
Why does autofit not shrink my row height?
If you previously set a manual row height, autofit may not override it. Select the row, use Home > Format > Row Height to set a smaller value, then try AutoFit Row Height again.
Can I autofit using a keyboard shortcut?
Yes. On Windows, select the column and press Alt+H, then O, then I. On Mac, there is no default single shortcut, but you can use the Format menu.
Does autofit change my font or formatting?
No. Autofit only adjusts column width or row height. Font, color, borders and number formats stay the same.
Why is the Format button greyed out?
The sheet may be protected or you may still be editing a cell. Press Esc to exit edit mode, and unprotect the sheet via Review > Unprotect Sheet if needed.