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. When you turn on Wrap Text and the row stays stuck at 15 pixels, the AutoFit Row Height command is the tool that solves it. This guide walks through every method โ ribbon clicks, keyboard shortcuts, double-click tricks, and VBA โ for both Windows and macOS versions of Microsoft Excel 365, 2021, 2019, and 2016.
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 the moment you have a worksheet with 4,000 customer notes, 800 product descriptions, or a quarterly report where each row contains a multi-line address. Auto row height removes the manual drag entirely and recalculates the row whenever cell content changes.
The default row height in Excel is 15 points (20 pixels) on Windows and roughly 16.5 points on macOS, calibrated to the Calibri 11pt font. When you increase font size, enable wrap text, or paste content with embedded carriage returns (Alt+Enter on Windows, Control+Option+Return on Mac), the row needs to grow. AutoFit measures the tallest cell in that row and sets the height to match โ but only when Excel is told to recalculate.
There are five reliable ways to trigger auto row height: the Home ribbon (Format โ AutoFit Row Height), the keyboard shortcut Alt+H+O+A on Windows, double-clicking the bottom border of a row header, the right-click context menu on selected row numbers, and a single line of VBA (Rows.AutoFit). Each method achieves the same result, but each behaves differently when merged cells, hidden rows, or filtered ranges are involved. Knowing the difference matters when you are debugging a spreadsheet that refuses to cooperate.
Auto row height interacts with several other Excel features in ways that surprise new users. Merged cells break AutoFit entirely โ Excel cannot measure wrapped text across a merge and will keep the row at single-line height even when content overflows. Frozen panes do not block AutoFit, but they can make oversized rows look truncated above the freeze line. Filters preserve the original row height when rows are hidden, then restore it when filters clear. Understanding these interactions saves hours of confused troubleshooting.
This article assumes you are working in a standard Excel environment with multiple rows of text content, possibly imported from CSV, copied from a web page, or typed manually with Alt+Enter line breaks. We will cover the foundations first โ what auto row height actually does, when it triggers automatically, and when you must invoke it manually โ then move into the edge cases where AutoFit fails and what to do when it does. By the end you will know exactly which method to reach for in every scenario.
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. The methods below will feel intuitive once you understand the underlying mechanics of how Excel renders cells and decides when to recompute vertical space.
Select rows, then click Home tab โ Format dropdown in the Cells group โ AutoFit Row Height. This is the most visible path and works identically across all Windows and Mac versions of Excel 365 and 2021.
On Windows, press Alt+H+O+A in sequence โ Alt opens KeyTips, H selects Home, O opens Format, A triggers AutoFit Row Height. Fastest method for power users who avoid mouse movement during data cleanup.
Hover the cursor on the bottom border of a row header until it becomes a double-headed arrow with a horizontal line, then double-click. Excel resizes that single row to fit its tallest cell instantly.
Select row numbers in the gray header column, right-click, and choose Row Height. While this opens a manual dialog, selecting multiple rows then double-clicking any border AutoFits the entire selection at once.
Open the VBA editor with Alt+F11, then run Rows.AutoFit or Range("A1:A500").EntireRow.AutoFit. Essential for automated workflows, after-paste cleanup, or worksheets where row heights need recalculation on every save.
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. To select non-contiguous rows, hold Ctrl (Windows) or Command (Mac) while clicking each row number. Selecting the Select-All triangle at the top-left corner of the worksheet selects every row, allowing you to AutoFit the entire sheet in one operation.
With rows selected, navigate to the Home tab on the ribbon. Look for the Cells group, which sits between the Styles group and the Editing group on the far right. Inside the Cells group are three icons: Insert, Delete, and Format. Click Format. A dropdown appears with cell size options at the top: Row Height, AutoFit Row Height, Column Width, AutoFit Column Width, and Default Width. Click AutoFit Row Height. Every selected row immediately resizes to fit the tallest content in that row, whether that content is wrapped text, a large font, or an embedded line break.
The keyboard sequence Alt+H+O+A produces the same outcome in roughly half a second. Press Alt by itself first โ small KeyTip letters appear above each ribbon tab. Press H to jump to the Home tab. Press O to open the Format dropdown in the Cells group. Press A to select AutoFit Row Height. Excel processes the command before your finger leaves the A key. For users cleaning up imported CSV data ten times a day, this shortcut saves several minutes per session compared to mouse navigation.
Double-clicking is the quickest single-row resize method. Move the cursor between two row numbers in the header column until it changes shape โ a horizontal line with arrows pointing up and down. Double-click while the cursor shows this shape, and the row above the cursor snaps to fit its content. The trick most users miss: if you select multiple rows first by clicking and dragging row numbers, then double-click any border within that selection, every selected row AutoFits simultaneously. This combines the precision of double-click with the speed of bulk operations.
The right-click context menu offers a slightly different path. Select rows, right-click on the row numbers (not on cell content โ right-clicking cell content shows a different menu), and choose Row Height. The dialog that appears requires a number, which is manual resizing rather than AutoFit. However, the dialog reveals the current row height value, which is useful for debugging. A value of 15 means the row is at default height and AutoFit did not trigger. A value above 50 typically indicates wrapped text or a manual override that needs investigation.
Knowing which method to choose depends on the situation. Single-row fixes use double-click. Bulk worksheet cleanup uses Select All followed by Format โ AutoFit Row Height. Repetitive workflows use VBA macros assigned to keyboard shortcuts. Mixing the methods is fine. The result is identical โ Excel measures the tallest cell in each row, accounting for wrap text, font size, and line breaks, then sets row height to match. Practicing core operations like this with structured Excel practice questions builds the recall speed needed to move quickly during deadline work.
One subtlety worth knowing: AutoFit applies to rows individually, not collectively. 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 default height. There is no global maximum or minimum row height that AutoFit imposes. If you need uniform row heights across a range, use Row Height (the manual dialog) instead of AutoFit, and enter a single value that accommodates your tallest expected content.
Windows Excel 365, 2021, 2019, and 2016 all support identical AutoFit Row Height behavior. The ribbon path is Home โ Format โ AutoFit Row Height, and the keyboard sequence Alt+H+O+A works in every version since Excel 2007. Double-clicking the row header border resizes a single row instantly. Right-click menus offer Row Height for manual values but no direct AutoFit option โ that lives only in the ribbon Format dropdown.
Windows also supports the most complete VBA implementation. Rows.AutoFit, Selection.EntireRow.AutoFit, and Range("A1:A100").EntireRow.AutoFit all work without modification. Workbook-level macros assigned to Workbook_Open events can AutoFit every sheet on file open. This is the version where remove duplicates Excel workflows often pair with AutoFit, because removing rows changes which content is tallest in remaining rows and requires recalculation.
Excel for Mac (365 and 2021) supports AutoFit Row Height through Home โ Format โ AutoFit Row Height, identical to Windows. The keyboard shortcut differs: macOS users press Control+Option+Return for line breaks inside cells, then use the ribbon for AutoFit. There is no direct keyboard sequence equivalent to Alt+H+O+A on Mac, but Command+Shift+J can open the ribbon for keyboard navigation if you have enabled accessibility shortcuts.
Double-clicking row header borders works identically on Mac. The cursor changes to a horizontal resize indicator, and double-click triggers AutoFit for that row or any selected range. VBA support is present but slightly more limited than Windows โ most basic AutoFit macros work, but advanced workbook events behave inconsistently between Excel for Mac versions. For users frequently switching between platforms, the ribbon method is the most reliable cross-compatible workflow.
Excel on the web (Microsoft 365 in a browser) supports AutoFit Row Height with reduced functionality. The Home โ Format โ AutoFit Row Height menu exists and works on standard rows. Keyboard shortcuts are inconsistent โ Alt key sequences clash with browser shortcuts, so most web users rely on mouse-driven ribbon clicks. Double-clicking row header borders does work in modern Chrome, Edge, and Safari browsers.
VBA is not available in Excel for the Web, which means automated AutoFit workflows must move to Office Scripts (TypeScript-based automation) instead. Office Scripts can call worksheet.getRange().getFormat().getRowHeight() and similar APIs for programmatic resizing. Web users editing shared OneDrive or SharePoint workbooks should remember that merged cell limitations are identical to desktop versions โ AutoFit will not measure wrapped content correctly across merges in any platform.
Click the gray triangle at the intersection of row numbers and column letters to Select All, then press Alt+H+O+A. Every row on the worksheet resizes to fit its content in under a second, even on sheets with 50,000 rows. This is the fastest cleanup pattern after pasting from PDF or web sources.
When AutoFit Row Height refuses to work, the cause is almost always one of five specific conditions. Merged cells are the most common culprit. Excel cannot measure wrapped text inside a merged range because the rendering engine treats merges as a single oversized cell that does not communicate its overflow back to the row height calculation.
If row 12 contains a merged range across columns A through E with wrapped text, AutoFit will leave row 12 at default height regardless of how much content overflows. The fix is to unmerge the cells, apply Center Across Selection from the Format Cells dialog instead, then run AutoFit.
Manual row height overrides are the second common cause. If anyone has previously set a row to a specific height through the Row Height dialog, Excel remembers that value as a manual setting. AutoFit will overwrite it, but only when AutoFit is explicitly invoked โ automatic recalculation does not trigger on cells that have manual heights stored. You can identify manually-sized rows by selecting a row, opening the Row Height dialog, and observing the displayed value. A value that does not match the surrounding rows likely indicates a manual override.
Hidden rows behave unpredictably with AutoFit. When you select a range that includes hidden rows and run AutoFit, Excel resizes the visible rows but leaves hidden rows untouched. If you later unhide those rows, their heights may be wrong. The workaround is to unhide all rows before running AutoFit, then re-hide the rows you wanted hidden. Filters present a similar issue โ AutoFit during an active filter only affects visible rows, so clearing the filter afterward reveals rows with stale heights.
Protected worksheets silently block AutoFit. If a worksheet has been protected through Review โ Protect Sheet, and the protection options do not include Format Rows, then AutoFit Row Height will fail without an error message. The ribbon command runs, the keyboard shortcut runs, but no rows resize. The fix is to unprotect the sheet temporarily, run AutoFit, then re-protect it with the Format Rows permission enabled. This is a common stumbling block in shared templates distributed across teams.
Conditional formatting that changes font size based on cell values can produce phantom AutoFit results. If a conditional rule sets font size to 24 points when a value exceeds a threshold, the row height grows accordingly. When the value drops below the threshold and the font returns to 11 points, the row keeps its expanded height until AutoFit is invoked again. This catches users by surprise because the row looks oversized for content that visually appears small. Re-running AutoFit on the range resolves it.
VBA AutoFit calls can also fail when run on ranges that include rows from filtered tables (ListObjects). The fix involves looping through filtered rows individually rather than calling EntireRow.AutoFit on the whole table. A safer pattern is to remove the filter, AutoFit the entire range, and reapply the filter afterward. Several practice scenarios for this kind of debugging appear in advanced Excel functions question banks, which are useful for building the diagnostic instincts needed to spot these issues quickly.
One final cause worth knowing: Excel files saved from older versions (.xls format from Excel 2003 and earlier) sometimes preserve row heights that ignore AutoFit. Re-saving the file as .xlsx and running AutoFit fresh usually resolves the issue. This is rare in modern workflows but appears occasionally when legacy templates are still in circulation, especially in regulated industries where document formats are slow to update.
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 AutoFit to every row on the active worksheet. Open the VBA editor with Alt+F11, insert a new module from the Insert menu, paste Sub AutoFitAll() then a line with Cells.EntireRow.AutoFit followed by End Sub, and you have a reusable macro. Assign it a keyboard shortcut through Developer โ Macros โ Options, and a single keystroke like Ctrl+Shift+F now resizes every row instantly.
More precise control comes from targeting specific ranges. Range("A1:A500").EntireRow.AutoFit AutoFits only the first 500 rows. Sheets("Data").Rows.AutoFit AutoFits every row on a sheet named Data, even if it is not the active sheet. For multi-sheet workbooks, a For Each loop iterates through Worksheets in ThisWorkbook and calls AutoFit on each. This pattern is essential for monthly report templates where freshly pasted data needs consistent row heights across dozens of tabs.
Event-driven AutoFit is the most powerful pattern. The Worksheet_Change event fires every time a cell in the worksheet is edited. Adding Target.EntireRow.AutoFit inside that event handler makes Excel resize the affected row automatically whenever its content changes. Use this with caution on large worksheets โ the event fires on every keystroke commit, so 100,000-row sheets become sluggish. A common compromise is to wrap the AutoFit call in a condition that only fires when the changed cell is in a specific column or range.
Workbook_Open events can ensure every sheet starts the session with correct row heights. Inside the ThisWorkbook code module, the Workbook_Open subroutine runs once when the file opens. Adding a loop that calls Rows.AutoFit on every worksheet guarantees no stale heights survive between sessions. This pairs well with templates distributed to teams, because the template enforces formatting consistency regardless of how previous users left the file.
Error handling matters in production macros. Wrap AutoFit calls in On Error Resume Next and check Err.Number afterward. Protected sheets, locked cells, or chart sheets included accidentally in a Worksheets loop will throw errors that halt execution otherwise. A well-formed macro catches the error, logs which sheet failed, and continues processing remaining sheets. This is the kind of resilience that separates production macros from quick scripts. Working through formula-focused practice problems builds intuition for similar defensive patterns in calculation logic.
Office Scripts is the modern alternative for cloud-based workflows. If your team works in Excel for the Web, Office Scripts written in TypeScript can call workbook.getActiveWorksheet().getRange().getFormat().autofitRows(). The syntax differs from VBA, but the underlying behavior is identical. Office Scripts can be triggered by Power Automate flows, which means AutoFit can run automatically when a workbook is saved to OneDrive or when a SharePoint list item is updated. This is the direction Microsoft is moving for automation in shared cloud environments.
One macro pattern worth memorizing: after running Remove Duplicates or Sort operations, always call EntireRow.AutoFit on the remaining range. Removing rows can leave gaps where the tallest content has been deleted, but surrounding rows keep their old heights. A two-line cleanup at the end of the macro โ one to remove duplicates, one to AutoFit โ produces a polished result every time. This habit pays dividends when you start chaining operations into multi-step data pipelines.
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 that AutoFit normalizes in one step. Make Select-All followed by Alt+H+O+A your default first action on any imported sheet. The second habit is enabling Wrap Text on text-heavy columns before pasting, not after, because Wrap Text triggers automatic row sizing in some scenarios that wrapping after the fact does not.
Use column widths intentionally before applying AutoFit Row Height. If your columns are too narrow, text wraps into more lines than necessary, producing oversized rows that waste vertical space. Widen text columns to comfortable widths (perhaps 30 to 50 characters) first, enable Wrap Text, then AutoFit Row Height. The result is a clean two- or three-line wrap rather than a sprawling eight-line block. This single ordering change improves readability dramatically on reports printed to PDF or shared as screenshots.
Combine AutoFit with frozen header rows for long worksheets. Freezing the top row keeps column headers visible while scrolling, and AutoFit ensures the frozen row itself displays correctly when headers contain wrapped text. The combination is essential for dashboards and data exports that other team members will navigate. Without AutoFit, frozen rows with wrapped headers truncate to default height and hide critical context. With AutoFit, the frozen row expands once and stays expanded.
Print preview is the final test for any AutoFit cleanup pass. Open File โ Print and scroll through the preview. Rows that look correct on screen sometimes truncate in print because of page break placement. If a row contains six lines of wrapped text and a page break falls in the middle of it, the printed result splits awkwardly. Adjust either the row content or the page break to keep wrapped rows intact. This is where Page Break Preview view (View โ Page Break Preview) becomes invaluable for tuning long reports.
For files shared with non-technical users, document your AutoFit approach in a hidden setup sheet. A simple instruction like "Press Ctrl+Shift+F to resize all rows after editing" prevents the inevitable support questions when someone's pasted content disappears below the visible cell. Pair the instruction with a macro button on the ribbon or in a dedicated cell, and even Excel beginners can maintain consistent formatting without help. Templates built this way age well and remain usable years after their creator has moved on.
Performance tuning matters on very large worksheets. AutoFit on a million-row sheet can take 30 seconds or more, depending on hardware. If you find yourself waiting, break the operation into smaller chunks โ AutoFit the visible portion first, then run AutoFit on lower sections only when needed. For automated pipelines, run AutoFit at the end of the data load, not after every batch insert. The cumulative time savings are substantial when you process the same files daily.
The final tip is the most underappreciated: trust the default. AutoFit produces the right answer in roughly 95% of scenarios with no configuration needed. The temptation to manually drag rows to "perfect" heights almost always introduces inconsistency that creates problems later. When in doubt, let AutoFit decide. Excel's row height calculation engine accounts for font metrics, line spacing, and wrap text behavior in ways manual sizing cannot match. Embrace the default, save the hours, and use your attention for the formulas, analysis, and decisions that actually matter to your work.