How to Autofit Rows in Excel With a Keyboard Shortcut

How-to basics · Updated November 20, 2026

In Excel for Microsoft 365 on Windows, select the row or cells you want to adjust, then press Alt, H, O, A one key at a time to run AutoFit Row Height. Excel increases or decreases the selected rows so their contents fit. This is useful when text is cut off or wrapped onto extra lines; you do not need to estimate a height manually.

What You’ll Need

  • A workbook open in the desktop version of Excel for Microsoft 365 on Windows.
  • At least one row or cell selected. You can select a single row, several rows, or a cell range whose rows need adjusting.
  • For the keyboard sequence, an English-language Excel ribbon is assumed. If your ribbon uses another language or the keys do not work, use the ribbon path described below.

You do not need to install an add-in or change a setting. AutoFit changes row height in the worksheet; it does not rewrite cell contents or change the column width. If you want to see long text on multiple lines, first turn on Wrap Text or make the column wider as appropriate.

Step-by-Step

  1. Open the worksheet and identify the rows. Look for cells with clipped text, wrapped text that is only partly visible, or content that has more lines than the current row can display. AutoFit works on the rows you select, so decide whether you need to adjust one row, a block of rows, or the whole sheet.
  2. Select the row or rows. To adjust one row, click its number along the left edge of the worksheet. For neighboring rows, drag over their row numbers, or click the first row number, hold Shift, and click the last. To select separate rows, hold Ctrl while clicking each row number. If you select cells instead, Excel adjusts the height of every row those cells occupy.
  3. Press the shortcut in sequence. Press and release Alt, then press H, then O, then A. Do not hold all four keys down together. This is Excel’s ribbon KeyTip sequence for Home > Format > AutoFit Row Height. The selected row or rows should resize to fit their contents.
  4. Check the result at the affected rows. Make sure the final line of text is visible and that the height is not larger than needed. If the text still appears clipped, confirm that the correct rows were selected, then review the column width, wrapping, merged cells, and any manually set height. Those details can affect what AutoFit can calculate.
  5. Use the ribbon if the shortcut is unavailable. Select the rows or cells, open Home > Format > AutoFit Row Height, and let Excel set the height. This route is useful when KeyTips differ because of a localized ribbon, when you are using Excel for Mac or the web, or when you prefer to confirm the command by name.
  6. AutoFit every row in the worksheet when needed. Click the triangle at the top-left corner of the grid, where the row and column headings meet, to select the entire sheet. Then press Alt, H, O, A, or choose Home > Format > AutoFit Row Height. Use this for a sheet-wide cleanup, but be aware that every row may change height, including rows that already looked right.
  7. Adjust columns first if the layout is the real problem. A narrow column can make a sentence wrap into many lines, so AutoFit may create a very tall row. Widen the column or use Home > Format > AutoFit Column Width if that suits the layout, then run AutoFit Row Height again. Column width and row height are separate settings.

On Excel for Mac, the Windows Alt sequence is not the standard way to access this command. Select the rows and use Home > Format > AutoFit Row Height; ribbon labels can vary slightly by release. You can also move the pointer to the lower boundary of a row number and double-click it to AutoFit that row. In Excel for the web, use the Home ribbon command when available, or double-click a row boundary. These alternatives avoid relying on a Windows-only KeyTip sequence.

Common Mistakes

  • Pressing the keys as a single chord. The Windows command is a sequence: Alt, then H, then O, then A. Press and release each key in order. Holding Alt while pressing the remaining letters may not trigger the ribbon command.
  • Selecting a cell but expecting only that cell to change. Row height belongs to the entire row. If a cell range is selected, AutoFit affects all rows intersecting that range, not just the selected cells themselves.
  • Expecting AutoFit to wrap text automatically. AutoFit calculates a row height based on the content and current layout, but it does not turn on Wrap Text. If a long entry is meant to display on several lines within a fixed-width column, select the cells and choose Home > Wrap Text before running AutoFit.
  • Using AutoFit as a substitute for choosing a suitable column width. A very narrow column can force text onto numerous lines and make rows unusually tall. Consider whether a wider column, a shorter entry, or a different layout would be easier to read.
  • Applying it to the whole worksheet without checking the selection. Selecting the entire sheet can change many rows, including blank rows or sections that use deliberate spacing. Start with the affected range if only part of the sheet needs attention.
  • Assuming a manually sized row will always behave as expected. If a row has a fixed or previously adjusted height, rerunning AutoFit may change that height. Review any carefully formatted headings or report sections afterward.

Tips

  • Use row numbers for a precise selection. Clicking a row number makes it clear that the full row is selected. This is helpful when the content you want to fit is spread across several columns.
  • Use the selection that matches the job. For a quick correction, select only the problem rows. For a newly imported table, select the table’s rows. For a full-sheet reset, select the whole sheet and then check special headings and spacing.
  • Run AutoFit after changing text or wrapping. If you edit a cell, paste longer content, or turn Wrap Text on after adjusting the row, run AutoFit again so the height is recalculated for the current contents.
  • Use a boundary double-click for a one-row fix. Move the pointer to the bottom edge of the row number until the resize pointer appears, then double-click. This is a quick mouse alternative and does not require opening the ribbon.
  • Remember that row height is measured for the whole row. A tall entry in one column can make the entire row taller, leaving extra white space under shorter entries in other columns. That is normal; Excel cannot assign different heights to individual cells in the same row.
  • Keep merged cells in mind. AutoFit may not calculate the expected height for text in merged cells. If a merged heading is cut off, consider unmerging the cells, adjusting the height manually, or changing the layout so the text is in an unmerged cell.

Troubleshooting

The shortcut does nothing. Confirm that you are using Excel for Windows and pressing Alt, H, O, A in order. If the ribbon is localized, a different version is in use, or a key is intercepted by another feature, use Home > Format > AutoFit Row Height. You can also click a row boundary twice for a single row.

The row becomes taller but text is still missing. Check whether the relevant cells have Wrap Text turned on and whether the selected row contains all of the affected text. Look for merged cells, which can prevent automatic sizing from working as expected. If the text is still clipped, drag the row boundary downward to set a height manually, or revise the column layout.

Nothing changes even though the row looks too short. The visible content may not require more height at the current column width, or the clipping may be caused by another formatting or layout issue. Check the formula bar to see whether the cell contains more text than the grid displays. Also inspect whether the row is hidden or whether you selected the intended row numbers.

AutoFit makes rows much too tall. Look for a narrow column causing excessive wrapping, a cell with many line breaks, or an unexpectedly long value. Widen the column if appropriate, remove unwanted line breaks, or adjust only the rows that need it. Then run AutoFit again on that smaller selection.

A row is hidden or part of a filtered list. AutoFit does not make a hidden row visible. Unhide it by selecting the surrounding row numbers, right-clicking, and choosing Unhide. For filtered data, clear or change the filter if you need to see rows that are currently excluded, then adjust the visible rows as needed.

The height changes back later. Another user, macro, pasted formatting, or later worksheet action may reset row heights. If the sheet is shared or regularly refreshed, check the process that updates it. AutoFit is a formatting action, not a permanent rule that guarantees every future edit will resize every row.

Frequently Asked Questions

What is the keyboard shortcut to AutoFit row height in Excel?
In Excel for Microsoft 365 on Windows, press Alt, H, O, A one key at a time. Select the rows or cells first. The sequence opens the Home tab’s Format menu and runs AutoFit Row Height.

Can I AutoFit several rows at once?
Yes. Select multiple row numbers, or select cells across the rows you want to adjust, then run the shortcut or ribbon command. Excel calculates a suitable height for each selected row based on its contents.

Is there a direct AutoFit Row Height shortcut on a Mac?
The Windows Alt sequence is not the Mac equivalent. On Mac, select the rows and choose Home > Format > AutoFit Row Height, or double-click the lower boundary of a row number to fit that row.

Does AutoFit turn on Wrap Text?
No. AutoFit changes row height; it does not enable wrapping. If you want a long entry to display on multiple lines inside a column, turn on Home > Wrap Text first, then AutoFit the relevant rows.

Why does AutoFit not work properly with merged cells?
Excel may not calculate the height needed for text in a merged range. For reliable sizing, unmerge the cells where practical, or set the row height manually and check that the full heading is visible.

Can I AutoFit all rows in a worksheet?
Yes. Select the whole worksheet using the top-left grid corner, then run Alt, H, O, A on Windows or choose the ribbon command. Check the result afterward, because intentional spacing and headings may also be resized.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.