AutoFit in Excel automatically adjusts row height or column width to fit the content exactly, preventing text overflow or unnecessary white space. You need only a workbook open in Excel—no add-ins or special permissions required. This feature works in Excel for Microsoft 365, Excel 2021, Excel 2019, and Excel for the web.
What You'll Need
- Microsoft Excel installed (desktop) or access to Excel for the web
- A workbook with data in cells
- Basic familiarity with selecting cells or ranges
Step-by-Step
- Open your Excel workbook and navigate to the worksheet containing the data you want to adjust.
- To AutoFit column width:
- Select the column or columns you want to adjust (e.g., click the column header letter to select a single column; hold Ctrl on Windows or Command on Mac and click multiple headers for non-contiguous columns, or drag across headers to select a range).
- On the ribbon, go to the Home tab.
- In the Cells group, click the Format button.
- From the dropdown menu, choose AutoFit Column Width.
- To AutoFit row height:
- Select the row or rows you want to adjust (e.g., click the row number to select a single row; use Ctrl/Command + click or drag across row numbers for multiple rows).
- On the ribbon, go to the Home tab.
- In the Cells group, click the Format button.
- From the dropdown menu, choose AutoFit Row Height.
- For both row height and column width in one step:
- Select the entire block of data or the specific range you want to adjust (click and drag across cells, or press Ctrl + A twice to select the entire used range).
- Go to the Home tab.
- Click Format > AutoFit Row Height (this also adjusts column widths if content requires wider columns, but note: AutoFit Row Height alone does not affect column width).
- Then, repeat for AutoFit Column Width on the same selection to ensure both dimensions fit the content.
- Alternative keyboard shortcut method (desktop only):
- Select the column(s) or row(s).
- Press Alt, then H, then O, then U (for AutoFit Column Width).
- For AutoFit Row Height, press Alt, then H, then O, then I.
Common Mistakes
- Selecting entire rows or columns (e.g., clicking the row/column header for the full sheet row/column) and expecting AutoFit to work without limiting the selection to the data range—this can cause Excel to adjust based on hidden or distant content.
- Confusing AutoFit with manual resizing: AutoFit uses cell content and formatting (like font size or wrapping) to determine the ideal size; dragging the column/row border manually does not use this logic and may leave text cut off.
- Applying AutoFit to merged cells: Excel cannot AutoFit merged cells reliably because it calculates size based on the top-left cell only; this often results in incorrect sizing or no change at all.
- Forgetting to enable text wrapping for wrapped content: If text is wrapped across multiple lines but AutoFit Row Height doesn’t expand fully, check that Wrap Text is turned on (Home tab > Alignment group > Wrap Text).
- Using AutoFit on columns with formulas returning long error values (e.g., #N/A, #####) or dates formatted as text—these can force abnormally wide columns; review cell values before applying.
Tips
- Use Alt + H + O + A on Windows (or Cmd + Option + A on Mac) to AutoFit all columns in the current worksheet at once—just click any cell in the sheet first.
- After pasting data, run AutoFit immediately to prevent manual adjustments later; it’s a quick way to clean up imported reports or exports.
- For large datasets, AutoFit can be slow—consider filtering or hiding unnecessary rows/columns first to reduce the range being processed.
- Hold Alt while dragging a column or row border to see live width/height values as you resize; this mimics the AutoFit result visually and confirms accuracy.
- If your data includes images or shapes embedded in cells, AutoFit may not account for their size—resize or move these objects outside the grid cell area first for predictable results.
- AutoFit respects cell borders: thick borders may require slightly more space; if text still appears cramped, increase the column width by 1–2 units manually after AutoFit.
Troubleshooting
If AutoFit doesn’t work as expected, follow these checks:
- Ensure you’re in the correct worksheet tab—AutoFit only affects the currently active sheet. Switch tabs and reselect your range before retrying.
- Check for merged cells in your selection: unmerge them (select the range > Home tab > Alignment group > Merge & Center > Unmerge Cells), apply AutoFit, then re-merge if needed.
- Verify text wrapping is set correctly: select the cells > Home tab > Alignment group > ensure Wrap Text is checked if you want rows to expand for multi-line content.
- Look for hidden characters: copy the data to Notepad first, then paste back to remove hidden formatting or non-printing characters (Ctrl + A in Notepad, then Ctrl + C, then paste into Excel).
- Test with a single cell: type a short phrase (e.g., “Test”) into an empty cell and apply AutoFit—if it works, the issue is likely with your original data or formatting.
- Restart Excel if the ribbon or menus appear unresponsive; sometimes a temporary glitch prevents commands from executing.
- Check for protected sheets: if the sheet is protected (Review tab > Unprotect Sheet), you cannot AutoFit rows/columns unless protection allows formatting. Unprotect the sheet (with password if set), apply AutoFit, then re-protect if needed.
- Update Excel: outdated versions may have bugs affecting formatting. Go to File > Account > Update Options > Update Now (desktop) or open Excel for the web and refresh the page.
Frequently Asked Questions
Does AutoFit work on Excel for the web?
Yes, AutoFit is fully supported in Excel for the web. The steps are identical: select your range, go to Home > Format > AutoFit Column Width or AutoFit Row Height.
Why does AutoFit make columns too wide?
AutoFit sizes columns to the longest content, including very long text, formulas, or error values like ##### (which appears when a cell is too narrow for its date or number format). Check for unintended long entries or adjust the formatting of dates/times to shorter displays.
Can I AutoFit only specific columns and leave others unchanged?
Absolutely—just select only the columns you want to adjust before using AutoFit. Excel processes only the selected columns or rows, so unselected areas remain unaffected.
Is there a way to set AutoFit as the default behavior when typing?
No, Excel does not have a built-in setting to auto-adjust every time you type. You must manually apply AutoFit after entering or modifying data. Consider creating a simple macro (in desktop Excel) to automate this if you do it frequently.
Why does AutoFit Row Height not expand enough for wrapped text?
This usually happens if Wrap Text is not enabled. Turn it on for the selected rows (Home > Wrap Text), then reapply AutoFit. Also, ensure the font size isn’t set higher than the row’s default—Excel won’t shrink fonts to fit, only expand rows.
Does AutoFit work with tables (Insert > Table)?
Yes, but only within the table range. Select cells inside the table, then apply AutoFit. Table headers and totals rows may need separate selection since they can have fixed heights or widths depending on table style settings.