In Excel for Microsoft 365 on Windows, the AutoFit column-width shortcut is Alt+H, O, I; for row height, use Alt+H, O, A. Press the keys in each sequence one after another, not all at once. Select the relevant cells, rows, or columns first, and Excel will size them to fit their contents.
What the AutoFit shortcuts do
AutoFit changes a column’s width or a row’s height so the cell contents can be displayed more fully. The Windows sequences use Excel ribbon Key Tips: Alt opens the Key Tips, H selects the Home tab, O opens the Format menu, and I or A chooses the relevant AutoFit command. The letters are for the standard English-language Windows ribbon; localized versions can show different Key Tips.
- Alt+H, O, I: AutoFit Column Width.
- Alt+H, O, A: AutoFit Row Height.
For example, if a heading in column B is clipped, select a cell in column B and press Alt+H, O, I. Excel widens the column to fit its widest relevant entry. To expand a row so wrapped text is visible, select a cell in that row and use Alt+H, O, A. These commands do not change the text, formulas, or number formats; they change the selected row or column dimensions.
AutoFit a column step by step
To adjust one column, click a cell in it, then enter the column-width sequence. Alternatively, use the ribbon path Home > Format > AutoFit Column Width. The command applies to the column containing the active cell, or to all selected columns if you have selected more than one.
To AutoFit several adjacent columns, select cells across those columns or drag across their column letters, then press Alt+H, O, I. For separate, nonadjacent columns, hold Ctrl while selecting their column letters, then run the same sequence. You can also double-click the divider on the right edge of a selected column heading; when multiple columns are selected, double-clicking a divider can AutoFit the selection.
A quick way to select a column from a cell is Ctrl+Space. After selecting it, run the shortcut. Ctrl+Space selects the whole worksheet column, not just the visible portion of a table, so use it carefully if the sheet has other content farther down.
AutoFit row height
To fit one row, select a cell in it and press Alt+H, O, A, or choose Home > Format > AutoFit Row Height. To fit multiple rows, select their row numbers or cells in those rows first. The command checks the contents in the selected rows and adjusts their heights as needed.
AutoFit is especially useful when text wrapping is turned on. With a narrow column, a long cell entry may occupy several lines; AutoFit Row Height can expand the row to show those lines. Without wrapping, long text generally continues visually into neighboring empty cells, rather than making the row taller. To wrap a cell’s text, select it and choose Home > Wrap Text, then AutoFit the row if needed.
You can select a row from a cell with Shift+Space. If several rows are selected, the row-height command adjusts the selection. Double-clicking the boundary below a row number is another mouse-based way to AutoFit row height.
Fit an entire worksheet
To AutoFit every column on a worksheet, select the whole sheet, then run Alt+H, O, I. Repeat with Alt+H, O, A if you also want to AutoFit row heights. To select the worksheet, click the Select All button at the intersection of the row and column headings, or use Ctrl+A. In a populated area, Ctrl+A may first select the current data region; pressing it again generally expands the selection to the worksheet. Check the highlighted area before applying a change.
Fitting an entire sheet can produce unexpectedly wide columns if a cell contains a long note, URL, or unbroken string. It can also take longer in a workbook with a very large used range. If the result is awkward, undo immediately with Ctrl+Z, then select only the columns or rows that need adjustment. AutoFit is a layout operation, so it is often better to apply it to a specific table than to every column in a complex worksheet.
How Excel decides the size
AutoFit considers the displayed contents of cells in the selected column or row, along with factors such as font and formatting. It aims to make the content visible without manually guessing a dimension. Column width is measured using character-based units tied to the workbook’s default font, rather than as a simple number of pixels; row height is measured in points. As a result, a particular width value will not correspond to the same visual pixel width in every workbook or display setup.
For a column, a long entry can determine the width even if most other cells contain short values. For a row, wrapped text, font size, and cell formatting can affect the required height. AutoFit is not the same as making all columns equal: each selected column is sized according to its own contents. It also does not guarantee that a value will be readable in every situation, such as when a cell is merged or a column contains an unusually long string.
Common problems and fixes
- The sequence types into cells or does nothing: Make sure Excel is active, and press Alt, H, O, then I or A in order. Do not hold the letters down with Alt as one simultaneous shortcut. Ribbon Key Tips can also differ in a non-English installation.
- A number appears as ####: The column may be too narrow for the formatted number or date. Select the column and use AutoFit Column Width. If the result is too wide, choose a shorter number format or set a suitable width manually.
- Wrapped text is still cut off: Check that Wrap Text is enabled and then AutoFit the row. A manually fixed row height may need resetting through AutoFit Row Height.
- A merged cell does not resize as expected: Excel’s AutoFit does not reliably calculate row height or column width for merged cells. If possible, unmerge the cells and use Center Across Selection or adjust the row height and column width manually.
- A column becomes much wider than expected: Look for an unusually long entry elsewhere in that column, including far below the visible table. AutoFit considers contents in the selected column, not just the part currently on screen.
AutoFit also is not a substitute for checking print layout. A column that looks right on screen may still make a printed sheet too wide for one page. Use Print Preview and, if appropriate, adjust page orientation, scaling, margins, or selected column widths separately.
AutoFit compared with manual sizing
AutoFit is a good first choice when the goal is to show current cell contents quickly. Manual sizing is more useful when consistency matters more than fitting each column independently—for example, when several monthly reports should have identical column widths or a dashboard should preserve its layout as entries change.
For a manual width, drag the divider between column headings, or choose Home > Format > Column Width and enter a value. For a manual row height, choose Home > Format > Row Height. You can combine the approaches: AutoFit first, then drag a column slightly narrower or wider for a cleaner presentation. If the content later changes, run AutoFit again or retain the deliberate manual width.
Using AutoFit on Mac and Excel for the web
On Excel for Mac, the Windows Alt+H, O, I and Alt+H, O, A sequences do not apply as written. Use the equivalent commands from the menu bar: select the relevant cells or headings, then choose Format > Column > AutoFit Selection for columns, or Format > Row > AutoFit for rows. Double-clicking a row or column boundary is also a convenient equivalent. Mac keyboard shortcuts can vary with the keyboard and macOS settings, so the menu command is the dependable option.
In Excel for the web, select the desired columns or rows and use the Home tab’s Format options when available, or double-click the boundary in the headings. Browser and operating-system keyboard handling can affect ribbon shortcuts, so the mouse method or visible command is often simplest. The exact interface can vary as Microsoft updates the web app.
Frequently Asked Questions
What is the shortcut key for AutoFit column width in Excel?
In Excel for Microsoft 365 on Windows, press Alt+H, O, I in sequence. Select the target column or columns first, or place the active cell in a column to AutoFit.
What is the shortcut for AutoFit row height?
Use Alt+H, O, A on Windows. Select the relevant row or rows first; for wrapped text, confirm Wrap Text is enabled so the text can flow onto additional lines.
How do I AutoFit all columns at once?
Select the whole worksheet with the Select All button or Ctrl+A, confirm the intended sheet area is selected, then press Alt+H, O, I. A long value anywhere in a column can make that column wide.
Can I AutoFit a column by double-clicking?
Yes. Double-click the boundary on the right side of its heading, such as the line between B and C to AutoFit column B. For multiple columns, select them first and use the boundary method or ribbon command.
Why does AutoFit not work for merged cells?
Excel does not reliably AutoFit dimensions based on merged-cell contents. Unmerge the cells if practical, or set the row height or column width manually. Wrapping text in a merged cell does not remove this limitation.
Related
- Excel Insert Slicer: Why No Connections Are Found?
- Excel Insert X Rows: Fast Methods for Any Worksheet
- Excel Insert a Row Every X Rows: Methods That Work
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Hyperlink Text in ExcelTo hyperlink text in Excel for Microsoft 365 on Windows, enter the words you want displayed in a…
- How to Delete a Numbered Page in WordTo delete a page that has a page number in Word, remove the page’s content and any page…
- Excel Shortcut to Expand All Columns to Fit ContentsIn Excel for Microsoft 365 on Windows, select the whole worksheet and press Alt, H, O, I in…
- Remove a Section Break in Word for the Web: Step-by-StepTo remove a section break in Word for the web, show formatting marks, place the cursor immediately before…
- How to Merge Cells in Excel and Keep All TextTo merge cells in Excel and keep all their text, first join the contents with a formula such…
- How to Highlight Duplicates in an Excel Column QuicklyTo highlight duplicates in an Excel column, select the cells you want to check, then choose Home >…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.