How to Autofit All Rows in Excel: Fast and Easy Methods
In this article
To autofit all rows in Excel, select the entire worksheet by clicking the triangle in the top-left corner (between column A and row 1) and then double-click the boundary line between any two row headers. This instantly adjusts every row height to fit the tallest piece of content within each respective row, ensuring no text is cut off and no excessive white space remains. This process is essential for cleaning up data imports, fixing formatting after a bulk paste, or preparing a professional report where varying text lengths make manual adjustments impractical.
What You'll Need
- A computer with Microsoft Excel installed (works across Windows and macOS).
- An open Excel workbook containing the data you wish to format.
- A mouse or trackpad for the double-click method, or a keyboard for the shortcut method.
Step-by-Step
Depending on your preference for mouse usage or keyboard shortcuts, there are several ways to achieve a perfect row fit. Note that menu labels may differ slightly depending on your version of Excel or your operating system.
Method 1: The Double-Click Shortcut (Fastest)
- Select All Cells: Click the Select All button, which is the small gray triangle located at the intersection of the row numbers and column letters in the top-left corner of the grid. Alternatively, you can press
Ctrl + A(Windows) orCmd + A(Mac). If your data is in a formal Table, you may need to press the shortcut twice to select the entire sheet. - Locate the Row Boundary: Move your cursor to the row headers on the far left side of the screen. Hover the mouse over the line that separates any two row numbers (for example, the line between row 4 and row 5).
- Trigger Autofit: Your cursor will change from a thick white cross to a double-sided arrow pointing up and down. While the cursor is in this state, double-click the left mouse button.
- Verify the Result: Excel will instantly scan every row in the selected area and adjust the height to fit the content of the tallest cell in each row.
Method 2: Using the Ribbon Menu (Visual)
- Select the Rows: Click and drag over the row numbers on the left to select a specific range, or click the Select All triangle to target the whole sheet.
- Open the Format Menu: Go to the Home tab on the top ribbon.
- Navigate to Cells: In the Cells group, click the Format button.
- Select AutoFit Row Height: From the dropdown menu that appears, click AutoFit Row Height. This performs the same action as the double-click method but is useful if you prefer using the menu system.
Method 3: The Keyboard Sequence (Power User)
- Select the Data: Press
Ctrl + Ato select the current region or the entire sheet. - Execute the Command: Press the following keys in sequence (do not hold them down together):
Alt, thenH, thenO, thenA. - Understanding the Sequence:
Altactivates the ribbon shortcuts;Hselects the Home tab;Oopens the Format menu; andAtriggers the AutoFit Row Height command.
Common Mistakes
Even a simple task like autofitting rows can encounter hurdles if certain Excel features are active. Here are the most frequent errors users make:
- Selecting Only One Cell: If you only have a single cell selected and double-click the row boundary, Excel will only autofit that specific row. To fix this, ensure the entire sheet is highlighted in gray before double-clicking.
- Confusing Column Autofit with Row Autofit: Users often double-click the boundary between column letters (e.g., between A and B). This adjusts the width of the column, not the height of the row. Ensure you are clicking the boundaries of the numbered rows on the left.
- Ignoring Merged Cells: This is the most common technical failure. Excel's AutoFit feature does not work on rows that contain merged cells. If a row contains a merged cell with wrapped text, the AutoFit command will ignore it, leaving the text cut off.
- Applying Autofit to Hidden Rows: If you have hidden rows within your selection, AutoFit will still apply to them. When you later unhide those rows, they will have been adjusted based on their content, which may or may not be what you intended for your visual layout.
Tips
To get the most out of your spreadsheet layout, combine row autofitting with these professional formatting techniques:
- Use Wrap Text First: AutoFit Row Height only works effectively if Wrap Text is enabled for cells with long strings of data. If Wrap Text is off, Excel treats the data as one long line and will keep the row height at the standard single-line size, even if the text extends far beyond the column width. Go to Home > Wrap Text before autofitting.
- Standardize Row Heights: If you want all rows to be exactly the same height regardless of content, select all rows, right-click any row header, select Row Height..., and enter a specific numerical value (e.g., 15 or 20).
- Combine with Column AutoFit: For a perfectly clean sheet, perform the row autofit first, then select all and double-click the boundary between any two column letters to AutoFit Column Width.
- Use Tables for Dynamic Formatting: Converting your data range into an official Table (
Ctrl + T) helps maintain consistent formatting, though you will still need to use the AutoFit methods described above when adding large amounts of text to a cell.
Troubleshooting
If you followed the steps but your rows are still not adjusting correctly, try these solutions in order of complexity:
1. Check for Merged Cells: As mentioned, merged cells break the AutoFit logic. To fix this, select the problematic area, go to the Home tab, and click Merge & Center to unmerge the cells. Once unmerged, try the AutoFit process again. If you need the visual look of a merged cell, use Format Cells > Alignment > Horizontal > Center Across Selection instead.
2. Verify Wrap Text Settings: If the row height isn't increasing to show multiple lines of text, it is because Excel thinks the text should stay on one line. Select the cells, click Wrap Text in the Home tab, and then perform the AutoFit double-click again.
3. Check for Protected Sheets: If the Format menu is grayed out or the double-click does nothing, the worksheet might be protected. Go to the Review tab and check if it says Unprotect Sheet. If it does, click it (you may need a password) to enable formatting changes.
4. Reset Row Heights: If the rows seem "stuck," try manually dragging a row boundary to a very large size and then double-clicking it again to trigger the reset logic.
Frequently Asked Questions
Why is AutoFit Row Height grayed out in my menu?
This usually happens because the worksheet is protected or the workbook is shared in a way that restricts formatting. Check the Review tab to see if the sheet is protected.
Can I autofit rows automatically as I type?
Excel does not have a built-in setting to autofit row height in real-time as you type. You must either double-click the boundary or use the Ribbon command after you have entered your data.
Does AutoFit work on a Mac the same way as Windows?
Yes, the double-click method and the Ribbon menu (Home > Format > AutoFit Row Height) are identical on macOS. The only difference is the keyboard shortcut for selecting all (Cmd + A instead of Ctrl + A).
Will AutoFit change the font size?
No, AutoFit only changes the height of the row to accommodate the existing font size. It will not shrink or grow your text to fit the space.
How do I autofit only specific rows instead of the whole sheet?
Instead of clicking the Select All triangle, hold the Ctrl key (Windows) or Cmd key (Mac) and click the individual row numbers you want to adjust. Once they are highlighted, double-click the boundary of any one of the selected rows.