To AutoFit row height in Excel, select the rows and choose Home > Format > AutoFit Row Height, or double-click the boundary below a row heading; to fit every row, click Select All first. AutoFit sizes each row to its contents, but Microsoft states it cannot be used on rows or columns that contain merged cells.
Excel auto row height is the feature that resizes a row vertically so every line of wrapped text, every oversized font, and every embedded line break fits inside the visible cell. This guide covers the ribbon, double-click, Key Tips, and VBA methods, using Microsoft's documentation for Microsoft 365, 2024, 2021, 2019, and 2016. For a broader overview, see our guide to row height in Excel.
Most spreadsheet users learn AutoFit by accident. You paste a paragraph into a cell, the text disappears below the cell border, and you start dragging row dividers manually. That approach works for three rows. It collapses when a worksheet holds thousands of customer notes or product descriptions. AutoFit removes the manual drag entirely.
Microsoft lists the default row height as 15 points. When you increase font size, enable Wrap Text, or add manual line breaks (Alt+Enter on Windows), the row may need to grow. AutoFit measures the tallest content in each row and sets the height to match, within the 409-point maximum.
There are five reliable ways to trigger it: the Home ribbon (Format, then AutoFit Row Height), Key Tips for keyboard access, double-clicking the boundary below a row heading, Select All plus double-click for the whole sheet, and VBA's Range.AutoFit method. Merged cells are the main exception, so it pays to know how they behave.
Merged cells break AutoFit: Microsoft states you cannot use AutoFit on a row or column that contains merged cells, and you must set those heights manually through the Format menu. Understanding this saves hours of confused troubleshooting.
This article assumes you are working with multiple rows of text content, possibly imported from CSV, copied from a web page, or typed manually with line breaks. We cover the foundations first, then the edge cases where AutoFit fails and what to do when it does.
Before going further, it is worth practicing core formatting skills with hands-on questions. Free Excel quizzes covering ribbon navigation, row formatting, and cell properties are an effective way to lock in muscle memory.
Select rows, then go to Home โ Cells โ Format and, under Cell Size, choose AutoFit Row Height. Microsoft documents this for Excel for Microsoft 365, 2024, 2021, 2019, and 2016.
Press Alt to display Key Tips, press H for the Home tab, then follow the letters shown on screen through Format to AutoFit Row Height. The on-screen letters are the reliable guide for your version.
Double-click the boundary below the row heading. Excel resizes that row to fit its contents.
Click Select All, then double-click the boundary below any row heading. Microsoft describes this as the quick way to autofit all rows on the worksheet.
Open the VBA editor with Alt+F11, then run Rows.AutoFit or Range("A1:A500").EntireRow.AutoFit. Useful for automated workflows and after-paste cleanup.
Walking through AutoFit Row Height step by step removes most of the confusion users feel when wrap text behaves unexpectedly. Start by selecting the rows that need resizing. Click a row number in the gray header column on the left, or drag across multiple row numbers to select a contiguous range. Clicking Select All at the top-left corner selects every row, so you can AutoFit the entire sheet in one operation.
With rows selected, go to Home > Cells > Format. Under Cell Size, select AutoFit Row Height. Every selected row resizes to fit its contents, whether that is wrapped text, a large font, or a manual line break.
The Key Tips route reaches the same command from the keyboard. Press Alt to display the Key Tips, then press H to open the Home tab, as Microsoft's own example shows. Follow the letters displayed on screen through Format to AutoFit Row Height. The letters you see are the authoritative sequence for your Excel version.
Double-clicking is the quickest single-row method. Move the cursor to the boundary below the row heading until it changes shape, then double-click, and the row fits its contents. For every row on the worksheet, click Select All and double-click the boundary below one of the row headings.
The Row Height dialog offers a different path. Select rows, go to Home > Format > Row Height, and type a value. That is manual resizing rather than AutoFit, but it is the right tool when you need every row at one identical height, or for merged cells where AutoFit cannot be used.
Knowing which method to choose depends on the situation. Single-row fixes use double-click. Bulk worksheet cleanup uses Select All followed by a double-click or Format, AutoFit Row Height. Repetitive workflows use VBA macros. The result is the same: Excel sizes each row to its content. Practicing core operations like this with structured Excel practice questions builds recall speed.
One subtlety worth knowing: AutoFit applies to rows individually. If row 5 contains four lines of wrapped text and row 6 contains one line, AutoFit gives row 5 a tall height and row 6 a shorter one. If you need uniform row heights across a range, use Row Height (the manual dialog) and enter a single value that accommodates your tallest expected content.
This table lists the AutoFit facts documented by Microsoft.
| Task | Verified method | Notes |
|---|---|---|
| AutoFit selected rows | Home > Cells > Format > Cell Size > AutoFit Row Height | Excel for Microsoft 365, 2024, 2021, 2019, 2016 |
| AutoFit one row | Double-click the boundary below the row heading | Fits the row to its contents |
| AutoFit every row | Select All, then double-click a row boundary | Microsoft quick tip |
| Set an exact height | Home > Format > Row Height, type points, OK | Manual, not AutoFit |
| Mac exact height | Format menu > Row > Height | Excel for Mac |
| Default height | 15 points | Minimum 0 hides the row |
| Maximum height | 409 points | Excel specifications and limits |
| Merged cells | AutoFit cannot be used | Set the height manually |
| Wrapped text cut off | Apply AutoFit Row Height or set height manually | Wrap Text article |
| VBA | Range.AutoFit on a row or range of rows | Errors on other ranges |
Sources: Change the column width or row height, Excel specifications and limits, AutoFit and merged cells, Wrap text, and Range.AutoFit (VBA).
Prepare for the Microsoft Excel exam with our free practice test modules. Each quiz covers key topics to help you pass on your first try.
Microsoft documents AutoFit Row Height for Excel for Microsoft 365, 2024, 2021, 2019, and 2016. The ribbon path is Home โ Cells โ Format โ Cell Size โ AutoFit Row Height. Double-clicking the boundary below a row heading fits a single row, and Select All plus a double-click fits every row.
VBA support is complete on Windows: Rows.AutoFit, Selection.EntireRow.AutoFit, and Range("A1:A100").EntireRow.AutoFit all size rows to their contents. The Range.AutoFit method must be called on a row or range of rows, otherwise Excel raises an error.
In Excel for Mac, double-click the separator beneath a row heading to fit the row to its contents. To type an exact value, choose Format from the menu bar, point to Row, and click Height. Select several row headings first to change more than one row, or use the Select All triangle to resize every row.
Microsoft's Mac instructions cover Excel for Microsoft 365 for Mac, Excel 2024, and Excel 2021 for Mac.
When AutoFit Row Height refuses to work, the cause is usually one of a few conditions. Merged cells are the most common culprit. Microsoft states that you cannot use AutoFit on a row or column that contains merged cells, and that you must set those heights manually through the Format menu.
Wrap Text is the second thing to check. Microsoft's wrap-text article explains that when wrapped text is not fully visible, you can apply Home > Format > AutoFit Row Height or set the height manually. A cell with Wrap Text off keeps its text on one line, so it never needs a taller row.
Exact heights are the third cause. If someone typed a value in the Row Height dialog, the row keeps that height until you run AutoFit Row Height again or type a new value.
Protection is the fourth. A worksheet protected through Review > Protect Sheet allows only the actions its author ticked, so formatting commands may be unavailable. Unprotect the sheet, run AutoFit, then reapply protection.
Finally, remember the limit: no row can exceed 409 points, so extremely long wrapped content will be cut off even after AutoFit. Widen the column, shorten the text, or reduce the font size. Several practice scenarios for this kind of debugging appear in advanced Excel functions question banks, which help build diagnostic instincts.
VBA opens the door to automation patterns that make AutoFit Row Height feel built-in to your workflow. The simplest macro is one line: Rows.AutoFit applies the Range.AutoFit method to every row on the active worksheet. Open the VBA editor with Alt+F11, insert a new module, paste Sub AutoFitAll() then a line with Cells.EntireRow.AutoFit followed by End Sub, and you have a reusable macro. Microsoft notes the Range object must be a row or range of rows, or a column or range of columns, otherwise the method generates an error.
More precise control comes from targeting specific ranges. Range("A1:A500").EntireRow.AutoFit fits only the first 500 rows. Sheets("Data").Rows.AutoFit fits every row on a sheet named Data, even if it is not the active sheet. For multi-sheet workbooks, a For Each loop over Worksheets can call AutoFit on each sheet.
Event-driven AutoFit is possible too. The Worksheet_Change event fires when cells are edited, and Target.EntireRow.AutoFit inside the handler re-fits the affected row. Test it on a copy first and limit it to specific columns, because an event handler that runs on every change can slow a large worksheet.
Error handling matters in production macros. Chart sheets or other sheets that cannot be resized will raise errors in a Worksheets loop, so wrap AutoFit calls in error handling that logs the sheet and continues. Working through formula-focused practice problems builds intuition for similar defensive patterns in calculation logic.
Practical AutoFit habits develop with repetition. The first habit is running AutoFit immediately after every paste operation. CSV imports, web copy-pastes, and content from email all bring inconsistent formatting, and Select All followed by a double-click on a row boundary fits every row in one step. The second habit is enabling Wrap Text on text-heavy columns before you AutoFit, because AutoFit only has more than one line to measure when text wraps.
Set column widths intentionally before applying AutoFit Row Height. If columns are too narrow, text wraps into more lines than necessary and produces oversized rows. Widen text columns first, enable Wrap Text, then AutoFit Row Height. Microsoft notes that wrapped data adjusts automatically when you change the column width, so the order matters.
Remember the fallback: when you need every row at one identical height, or when merged cells block AutoFit, type an exact value in Home > Format > Row Height instead. Manual heights are fine for fixed-format reports. Use AutoFit for content-driven layouts and let the numbers decide, then save the workbook once the heights look right.