In Excel for Microsoft 365 on Windows, find AutoFit on the Home tab: choose Format in the Cells group, then select AutoFit Column Width or AutoFit Row Height. For a quick column adjustment, select the column or columns and double-click the boundary on the right side of a selected column heading.
Where to find the AutoFit button
AutoFit is a command inside the Format menu, not usually a separate button displayed on the ribbon. On the Home tab, look toward the right end of the ribbon for the Cells group. Open Format and choose the command that matches what you want to resize:
- AutoFit Column Width adjusts selected columns to fit their contents.
- AutoFit Row Height adjusts selected rows to fit their contents.
If the ribbon is simplified or the Excel window is narrow, the Cells group or its commands may be condensed. Maximize the window, expand the ribbon, or use the search box at the top of Excel and search for AutoFit Column Width or AutoFit Row Height. The exact appearance can vary with ribbon layout, but the command remains available from the Home tab’s Format menu.
In Excel for Mac, select the columns or rows, then use the Home tab’s Format menu and choose the relevant AutoFit command. The double-click boundary method also works for columns. In Excel for the web, look under Home > Format for the AutoFit commands; if the ribbon is compressed, check the overflow menu. These approaches avoid relying on shortcuts that may vary across operating systems, keyboard layouts, or browser settings.
Fast ways to autofit column width
The fastest method for one column is often a mouse gesture. Move the pointer to the line between two column letters—for example, between A and B. When the pointer becomes a horizontal resize indicator, double-click the line. Excel adjusts column A to fit its contents. To size several adjacent columns, select their column headings first, then double-click the boundary of one of the selected headings. Excel applies AutoFit to the selected columns.
You can also select columns and use the ribbon command. Click a column letter to select the whole column; drag across column letters to select a group. For columns that are not next to one another, hold Ctrl on Windows while clicking their headings, then choose Home > Format > AutoFit Column Width. A useful Windows keyboard sequence, with the relevant columns selected, is Alt, H, O, I. Press the keys in sequence rather than all at once. Ribbon key tips can differ in other Excel versions or configurations, so the menu is a dependable alternative.
To autofit every column on a worksheet, select the entire sheet using the small triangle at the intersection of the row numbers and column letters, then choose AutoFit Column Width. You can also press Ctrl+A when appropriate, but selection behavior depends on where the active cell is and whether the sheet contains a data region. Using the sheet-corner selector makes the intention clear. Be aware that fitting every column can make a worksheet extremely wide if even one cell contains a long string.
How to autofit row height
AutoFit Row Height is useful when wrapped text, a large font, or a manual line break makes a cell taller than the row’s current height. Select the row numbers you want to adjust, then choose Home > Format > AutoFit Row Height. To adjust one row quickly, double-click the lower boundary beneath its row number. For a range of rows, select the rows first and double-click a boundary within the selection.
For example, suppose a cell contains a two-sentence note and its column has Wrap Text turned on. If the row is too short to show all the lines, AutoFit Row Height expands it to display the wrapped content. If you later change the column width, the text may wrap onto a different number of lines. Run AutoFit Row Height again if the row does not resize as expected.
On Windows, the keyboard sequence for AutoFit Row Height is Alt, H, O, A after selecting the rows. On a Mac, use the Home tab’s Format menu if a keyboard shortcut is unavailable or conflicts with macOS or the keyboard layout. Manually dragging a row boundary is another option when you want a particular height rather than a content-based fit.
What AutoFit measures—and what it does not
AutoFit sizes a row or column to accommodate the visible contents of its cells, taking the applied font and formatting into account. For a column, Excel considers the entries in the selected column and sets a width that can display the widest relevant entry. For a row, it considers the content and line layout in that row. Formulas are assessed by their displayed results, not by the length of the formula text in the formula bar.
Column widths in Excel are not simply measured in pixels. The width unit is related to the character width of the workbook’s default font, so two columns with the same width setting can look different if their fonts differ. Row height is measured in points. AutoFit is therefore a practical fit-to-content command, not a promise that every cell will have identical margins or that every displayed value will look equally spacious.
AutoFit does not change cell values, formulas, number formats, or the data itself. It changes row height or column width. It also does not decide that a long entry should be shortened: a long unwrapped text value can make a column very wide. For dates and numbers, the displayed format matters. A date formatted as a long weekday and month name may need more width than the same date shown numerically.
Choosing between AutoFit and a fixed size
AutoFit is a good choice when readability is more important than keeping a worksheet compact, such as when checking imported data or making a small report readable before sharing it. A fixed width is often better for dashboards, forms, printed reports, or sheets where columns need to line up consistently across sections.
- Use AutoFit when you want to reveal clipped labels, names, dates, or calculated results without guessing a width.
- Use a fixed width when a consistent layout matters or a few unusually long values would otherwise dominate the sheet.
- Use Wrap Text when long descriptions should remain within a chosen column width and display on multiple lines.
- Use Shrink to Fit sparingly when content must stay on one line in a fixed-size cell; it reduces the displayed font size to fit.
These choices can be combined. For instance, you might autofit columns containing short identifiers, set a fixed width for a comments column, and turn on Wrap Text for that column. After wrapping, autofit the row heights so the comments are visible. A sensible layout often uses AutoFit as a starting point, followed by small manual adjustments for consistency.
Common AutoFit problems and fixes
If a column does not become wide enough, first check whether the text is wrapped, whether the cell is merged, and whether you selected the intended column. Also check for a very long entry elsewhere in the selected column: AutoFit is based on the column’s contents, so a distant cell may determine the final width. If the column becomes far too wide, consider wrapping that text, shortening a heading, or choosing a fixed width instead.
Merged cells are a frequent source of confusion. AutoFit does not reliably calculate the needed row height for text in merged cells, and merged ranges can interfere with the expected fit. If a merged heading is cut off, try unmerging the cells, adjusting the row or column manually, or using Center Across Selection for a centered heading without merging. If the workbook’s layout requires merged cells, manual sizing may be the most predictable solution.
If a row stays short even though text is wrapped, confirm that Wrap Text is enabled and run AutoFit Row Height again. A manually set row height can also prevent the result you expect; use AutoFit or drag the row boundary to reset the visible height. If content is clipped after changing fonts, column widths, or number formats, run AutoFit again because those changes can alter the space required.
AutoFit can also create a print or navigation problem even when it works correctly. A column widened for a long address or note may push other columns off-screen or add pages to a printout. For a printed report, use Print Preview after resizing and consider setting a page orientation, scaling, or print area. Those print settings affect the page output; AutoFit itself only changes the worksheet’s row heights or column widths.
AutoFit compared with dragging and double-clicking
Dragging a boundary gives you direct control: you can make a column or row exactly as large as you want, but you must judge the size yourself. Double-clicking a column boundary asks Excel to fit the selected column or columns to their contents. The ribbon command performs the same kind of content-based adjustment and is particularly helpful when you want to make a deliberate selection or fit rows.
Do not confuse double-clicking a boundary with dragging it. A single click-and-drag sets a manual size; a double-click triggers AutoFit. If a precise, uniform design matters, use the ribbon’s Column Width or Row Height command to enter a size, rather than AutoFit. You can also apply the same fixed width to a group of selected columns, which is useful for tables with repeated fields.
Frequently Asked Questions
Is there an AutoFit button in Excel?
Yes. It is generally a command rather than a standalone button: go to Home > Format and choose AutoFit Column Width or AutoFit Row Height. The button or menu may look different if the ribbon is simplified or the Excel window is narrow.
What is the shortcut to AutoFit a column in Excel?
On Windows, select the column or columns and press Alt, H, O, I in sequence. To AutoFit row height, select the rows and press Alt, H, O, A. If these key tips differ in your setup, use the Home tab’s Format menu.
How do I AutoFit all columns at once?
Select the entire worksheet by clicking the triangle above row 1 and to the left of column A, then choose Home > Format > AutoFit Column Width. Review the result afterward: a single long cell can make one column exceptionally wide.
Why is AutoFit not working on a merged cell?
Excel does not reliably AutoFit merged-cell content, especially for row height. Unmerge the cells and use a normal layout, adjust the size manually, or use Center Across Selection when you need centered text across several columns.
Does AutoFit change the font or cell contents?
No. AutoFit changes the selected row height or column width to suit the current displayed content and formatting. It does not rewrite values or formulas and does not normally shrink the font; Shrink to Fit is a separate formatting option.
Can I undo AutoFit?
Usually, yes: press Ctrl+Z on Windows immediately after the adjustment, or use Undo on the Quick Access Toolbar. If you have made other changes since then, Undo may reverse those later actions first. You can also set the desired width or height manually.
Related
- Excel for Numerical Analysis: Uses, Limits, and Tips
- Excel Historical Sales Analysis: Find Trends and Patterns
- Excel Financial Analysis: Methods, Models, and Metrics
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Goal Seek in Excel: Steps, Examples, and Calc DifferencesIn Excel for Microsoft 365 on Windows, open Data > What-If Analysis > Goal Seek, then specify the…
- Excel Column Drop-Down List: Create and Manage OneTo add a drop-down list to an Excel column, select the cells that should contain it, then choose…
- Simple Checklist Template Excel: Build a Useful OneA simple checklist template in Excel needs a task column, a status column, and optional fields for an…
- How to Make a Timeline in PowerPointIn PowerPoint for Microsoft 365 on Windows, choose Insert > SmartArt > Process > Basic Timeline, enter your…
- How to Print a Selected Area in Excel on One Page OnlyTo print only part of a worksheet in Excel for Microsoft 365 on Windows, select the cells you…
- How to Add a Heading to Every Printed Page in ExcelTo repeat a heading row on every printed page in Excel for Microsoft 365 on Windows, open the…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.