In Excel for Microsoft 365 on Windows, select the column or columns and press Alt, H, O, then I—one key sequence at a time, not all together. Excel runs AutoFit Column Width and adjusts the selected columns to fit their contents. You can use the same sequence after selecting the whole worksheet to AutoFit every column.
What You’ll Need
- Excel for Microsoft 365 on a Windows computer. The shortcut below also works in many recent desktop versions of Excel for Windows.
- A worksheet with data in the columns you want to resize. Save the workbook first if you are about to change many columns, especially in a shared or carefully formatted sheet.
- For Excel for Mac or Excel for the web, use the alternate menu or ribbon instructions below; the Windows key sequence is not the same on every platform.
Step-by-Step
-
Open the worksheet and identify the columns. AutoFit uses the contents in a column to decide its width. It can account for long text, numbers, dates, and formulas that display a result. If you want to fit a whole table, locate its first and last column before selecting anything. If the sheet contains unrelated data elsewhere, avoid selecting the entire worksheet unless you really intend to resize all its columns.
-
Select the column or columns to adjust. For one column, click any cell in it; Excel can apply the command to that cell’s entire column. Selecting the column letter at the top is more explicit. For adjacent columns, drag across their column letters, or click the first letter, hold Shift, and click the last. For non-adjacent columns, hold Ctrl while clicking each column letter. You can also type a range such as
B:Din the Name Box to select columns B through D, then press Enter. -
Start the ribbon keyboard sequence. Press and release Alt. Excel displays Key Tips—small letters or letter combinations over ribbon tabs and controls. Press H to open the Home tab’s key commands. Do not hold Alt while pressing the remaining keys; treat each letter as a separate step. If your Excel window is narrow or the ribbon is simplified, the letters may be displayed differently, so follow the Key Tips shown on screen.
-
Open the Format commands. Press O, then I. The full Windows sequence is Alt, H, O, I. The first letter after Home opens the Format menu; the final letter chooses AutoFit Column Width. Excel immediately changes the selected columns. You do not need to open a dialog or confirm the change.
-
Check the result and repeat if needed. Look at the longest visible entries in each selected column. If text is still cut off, check for merged cells, wrapped text, hidden columns, or an unusually long entry. You can undo an AutoFit with Ctrl+Z if you have not made other changes since, then select a more appropriate range or use a manual width.
-
AutoFit every column when that is the goal. Click the Select All button, the small triangle at the intersection above row 1 and to the left of column A, or press Ctrl+A as needed to select the worksheet. Then press Alt, H, O, I. If the active cell is inside a data region, the first Ctrl+A may select just that region; press it again to select the entire sheet, or use the Select All button. Be aware that a sheet-wide resize can make many empty columns wide based on stray content far down the sheet.
On Excel for Mac, do not assume the Windows Alt sequence applies. Select the relevant column or columns, then use Format > Column > AutoFit Selection from the Mac menu bar, where available. The ribbon may also offer the command under Home > Format > AutoFit Column Width. In Excel for the web, select the columns and use Home > Format > AutoFit Column Width, or double-click the boundary between two column letters. The web app’s keyboard access can vary by browser and operating system, so the visible command is the reliable alternative.
Common Mistakes
Holding the keys down together. Alt, H, O, I is a sequence of ribbon Key Tips, not a four-key combination. Press Alt, release it, and continue with each letter in turn. If you press the wrong key, press Esc to leave the Key Tips and start again.
Selecting only the cells you can see. AutoFit is a column-width command. When you select a cell or a range of cells, Excel generally adjusts the columns those cells occupy, rather than resizing each cell independently. To remove uncertainty, select the column letters or enter a whole-column reference such as C:F in the Name Box.
Expecting a column to fit every possible display situation. AutoFit measures what Excel can display in the current worksheet, but long text may still be hard to read if the column is constrained by merged cells or if Wrap Text is enabled. A heading that spans several merged columns is not handled like an ordinary cell, so the width may not reflect the full heading.
AutoFitting the entire sheet accidentally. Selecting all columns can make a sheet awkward to navigate if a note, formula result, or pasted value far from the main table is unusually long. For a table-only adjustment, select only the table’s columns. Also remember that a hidden column stays hidden; AutoFit does not make it visible.
Confusing AutoFit with a permanent layout rule. AutoFit sets a width based on the contents present at the time you run it. It does not guarantee the column will keep fitting future entries. New or longer data can exceed that width, so run AutoFit again after importing or adding content if the layout needs to stay readable.
Tips
For a quick mouse alternative, place the pointer on the right edge of a column letter until it becomes a double-headed arrow, then double-click. If multiple columns are selected, double-clicking a boundary between selected column headings can AutoFit the selected columns. This is useful when you are already working near the top of the worksheet, while the keyboard sequence is convenient when you want to keep your hands on the keyboard.
Use the Name Box to make precise selections without scrolling to a column. It is the small box to the left of the formula bar, often showing the active cell address. Enter A:C and press Enter to select columns A through C, or enter a single column reference such as G:G. Then run the Windows shortcut. Check that the Name Box has focus before typing, or your reference may be entered into the active cell instead.
AutoFit each table column after bringing in a new export or pasted list, rather than fitting the whole sheet by default. This limits the impact of unrelated notes and formulas. If a few columns become excessively wide because they contain long descriptions, consider a fixed width and Wrap Text instead; that keeps the table compact while showing entries on multiple lines. Adjust row height as needed after changing wrapping.
Remember that AutoFit responds to the displayed result of a formula, not just the formula text. A formula such as one returning a long label can therefore widen the column substantially. If you want a compact report, consider whether the full result needs to be displayed, or use a deliberate width and wrapping. Avoid deleting or shortening valid data just to make the sheet look neater.
When editing a workbook used by other people, make a copy or note the existing widths before applying AutoFit to many columns. Column widths affect the layout of the sheet for everyone who opens the workbook. You can undo the command immediately with Ctrl+Z on Windows, but undo may no longer be available after closing the workbook or performing other actions.
Troubleshooting
The shortcut opens a different command or does nothing. Confirm that you are using desktop Excel for Windows and that you are pressing the keys in order: Alt, then H, then O, then I. Watch the Key Tips after pressing Alt. If your Excel build shows different letters, follow the displayed hints or use Home > Format > AutoFit Column Width. Keyboard layouts, remote-desktop settings, and browser versions can affect which keys are intercepted.
The column is still too narrow. Check whether the longest item is in a merged cell, whether the text is wrapped, and whether the value is actually in the column you resized. If the cell contains a date or number, its number format may make the displayed value wider than expected. Select the column and run AutoFit again after resolving the issue. For merged-cell layouts, manually set the width or unmerge the cells if that is appropriate for the worksheet.
The column became much wider than expected. Search the selected column for an outlier, such as a long note, URL, formula result, or accidentally pasted text. You can use Find to locate a distinctive part of the content, or inspect the column’s lower rows as well as the visible area. Undo, select only the table range, and AutoFit again. If the long entry is legitimate, use Wrap Text or a chosen width rather than allowing it to determine the width of every row.
Some columns did not change. Make sure they were included in the selection and are not hidden. A protected worksheet may prevent column formatting; if Excel reports that the sheet is protected, ask the workbook owner or unprotect it if you have permission. Also check whether you are editing a grouped selection or another sheet: when multiple worksheet tabs are grouped, a formatting change can affect all grouped sheets, so verify the tabs before proceeding.
You are using Excel for Mac or the web. Use the platform’s Home or Format menu instead of relying on a Windows Key Tip sequence. In Mac Excel, select the column and look for Format > Column > AutoFit Selection; in the web app, use Home > Format > AutoFit Column Width. If the command is not visible, widen the app window or open the relevant menu. Double-clicking a column boundary is another direct option in both desktop and web workflows.
Frequently Asked Questions
What is the keyboard shortcut to AutoFit columns in Excel for Windows?
Press Alt, H, O, then I, releasing each key before pressing the next. Select the columns first, or select the whole worksheet if you intend to fit all columns.
Can I AutoFit just one column?
Yes. Select a cell in that column or click its column letter, then run the shortcut. Clicking the column letter makes it clear which full column is selected.
How do I AutoFit every column in the worksheet?
Click the Select All triangle at the top-left of the grid, then run the shortcut. You can also use Ctrl+A; if it selects only the current data region, press it again or click Select All.
Is there a separate shortcut for AutoFit on a Mac?
The Windows sequence is not a dependable Mac shortcut. Select the columns and use Format > Column > AutoFit Selection or the equivalent AutoFit command on the Home ribbon.
Why does AutoFit not show all the text in a merged cell?
Excel does not AutoFit merged-cell content as reliably as ordinary cell content. Set a width manually, use wrapping, or reconsider the merged layout if the full text needs to remain visible.
Will AutoFit resize columns again when I add more data?
No. It sets the width based on the contents at the time you run it. Run AutoFit again after adding longer entries, or choose a fixed width and wrapping if the sheet needs a more consistent layout.
Related
- Freeze a Specific Row in Excel: Steps, Limits, and Tips
- Freeze Panes in Excel: Keep Rows and Columns Visible
- Freeze in Excel: Keep Rows and Columns Visible
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Find Duplicates in Excel and Google Sheets by FormulaIn Excel, select the cells and choose Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values;…
- Google Sheets Filter Views: Create, Use, and Share ThemA Google Sheets filter view is a saved way to sort or filter a table without changing the…
- Excel Mac Keyboard Shortcuts: Essential Keys and TipsIn Excel for Mac, use Command+C, Command+V, and Command+Z to copy, paste, and undo; use Command+Arrow to move…
- How to Create a Reusable Stationery Template in WordTo create a reusable stationery template in Word, design the page, place recurring elements such as a logo…
- How to Create a Mail Merge Document in Microsoft WordTo create a mail merge in Microsoft Word, prepare a recipient list—usually in Excel—then use Word’s Mailings tab…
- Find and Replace in Word: Open and Use the Dialog BoxIn Microsoft Word for Microsoft 365 on Windows, press Ctrl+H to open Find and Replace; in current versions,…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.