Autofitting cells in Excel automatically adjusts column width or row height to display all content without truncation or unnecessary blank space—no manual dragging required. You don’t need any special tools or add-ins; this feature is built into Excel for Windows, Mac, and Microsoft 365.
What You'll Need
- Microsoft Excel installed (Windows, Mac, or Microsoft 365)
- A workbook open with data in cells
- No additional software, permissions, or internet connection required
Step-by-Step
- Select the cells, columns, or rows you want to autofit. To select a single column, click its header (e.g., column A). To select multiple adjacent columns, click and drag across headers. To select all columns, click the triangle at the top-left corner (above row 1 and left of column A). For rows, click row numbers instead. You can also select a specific range of cells—autofit works on any selection, even non-contiguous ones (hold Ctrl while selecting).
- Use the ribbon menu: Go to the Home tab on the ribbon. In the Cells group, click Format. From the dropdown menu, choose AutoFit Column Width to adjust column widths only, or AutoFit Row Height to adjust row heights only. If you selected both rows and columns, Excel applies the appropriate autofit to each dimension based on your selection.
- Use the right-click context menu: With your selection still active, right-click anywhere inside it. In the pop-up menu, select Column Width for width, or Row Height for height—but wait: these options open input boxes. Instead, for true autofit, choose Column Width and then click AutoFit if available, or better yet: on newer Excel versions, the context menu directly shows Autofit Column Width and Autofit Row Height as top-level options. If you don’t see them, use the ribbon method instead.
- Use keyboard shortcuts: Press Alt to activate the ribbon keys, then H (Home tab), O (Format), U (Autofit Row Height) or I (Autofit Column Width). For column width only: Alt → H → O → I. For row height only: Alt → H → O → U. On Mac, use Control+Option+F for column width and Control+Option+H for row height (these are default; verify in Excel preferences if they don’t work).
- Double-click the column/row boundary: Position your mouse pointer over the line between two column headers (e.g., between A and B). The pointer changes to a thin vertical line with a small horizontal arrow. Double-click the boundary line—Excel instantly autofits that column’s width. Repeat for row height: position over the line between two row numbers (e.g., between 5 and 6), and double-click. This is the fastest manual method and works only for one column or row at a time.
Common Mistakes
- Autofitting with hidden rows/columns selected: If hidden rows or columns are included in your selection, Excel may misjudge the required space. Always unhide rows/columns (Right-click hidden header > Unhide) before autofitting, or select only visible cells using Ctrl+G > Special > Visible Cells Only.
- Using autofit on merged cells: Merged cells often break autofit behavior. Excel may ignore row height adjustments entirely if merged cells span multiple rows. Unmerge cells first (select > Home tab > Alignment group > Merge & Center dropdown > Unmerge Cells), then autofit.
- Autofitting with text wrapping disabled: If a cell contains wrapped text (text that flows to multiple lines), autofit row height only works if Wrap Text is turned on. Select the cell(s), go to Home > Alignment, and check Wrap Text before autofitting row height.
- Confusing autofit with manual resizing: Dragging the column boundary with the mouse only sets a fixed width—it doesn’t calculate the optimal fit. Use autofit commands, not manual dragging, for accuracy.
- Not selecting the full data range: If you only select part of a column (e.g., rows 10–20 in column A), Excel autofits only for that subset, ignoring longer text in other rows. Always select the entire column (click the header) or the full range of interest.
Tips
- Use AutoFit Column Width first: Fix column widths before row heights. Wide columns can make rows taller due to line breaks; adjusting width first often reduces the need for excessive height changes.
- Combine with Wrap Text: For large datasets, turn on Wrap Text before autofitting row height. This lets Excel calculate line breaks and set height based on actual visible lines, not wrapped overflow.
- Apply to entire sheet quickly: Click the top-left triangle to select the entire sheet, then use Home > Format > AutoFit Column Width. This adjusts all columns to fit their widest content. Repeat for rows if needed (though row height autofitting is less critical in wide sheets).
- Handle formulas and dates: Dates and formulas often appear longer than their results (e.g.,
=TODAY()may display as45123if formatted as General). Ensure cell formatting matches your data type (Home > Number group) before autofitting. - Use the Status Bar for quick feedback: After autofitting, hover over a column boundary—the tooltip shows the current width (e.g., “12.57”). Compare before/after widths to verify changes.
- Watch for special characters: Long Unicode symbols, emojis, or non-breaking spaces can inflate column width unexpectedly. Paste text as values only (right-click > Paste Special > Values) if formatting artifacts are causing oversized autofit.
Troubleshooting
If autofit doesn’t work as expected, follow these checks:
- Restart Excel: Occasionally, Excel enters a glitched state where commands ignore selections. Close all workbooks, restart Excel, and try again.
- Check for protected sheets: If the worksheet is protected, autofit may be disabled. Go to Review > Unprotect Sheet (enter password if required), autofit, then re-protect if needed. If you don’t know the password, contact the file owner—there’s no built-in way to bypass protection.
- Verify cell content visibility: Make sure content isn’t hidden by font color matching the background (e.g., white text on white). Select the cell, change font color to black temporarily, then autofit.
- Check for conditional formatting that truncates text: Some conditional formats (like custom number formats ending with
") can hide characters. Remove or edit the format, autofit, then reapply. - Inspect for extra spaces or line breaks: Press F2 on a cell to edit and reveal hidden spaces or
ALT+Enterline breaks. Delete unnecessary whitespace before autofitting. - Test in a new workbook: Copy the problematic range to a fresh workbook. If autofit works there, your original file may have corruption. Save as .xlsx (not .xls), then reopen.
- Update Excel: Older versions (e.g., Excel 2010 without updates) have known autofit bugs. Go to File > Account > Update Options > Update Now.
Frequently Asked Questions
Does autofit work in Excel Online?
Yes. In Excel for the web, select columns or rows, go to Home > Format > AutoFit Column Width or AutoFit Row Height. Double-clicking column boundaries also works in modern browsers.
Can I autofit only specific columns, not the whole sheet?
Absolutely. Select only the columns you want (e.g., columns C and D), then use any autofit method. Excel adjusts only the selected columns, leaving others unchanged.
Why does autofit make my row too tall when I have wrapped text?
Excel adds extra padding above and below wrapped lines. To reduce this, increase row height manually by a few pixels after autofitting, or adjust cell padding via Format Cells > Alignment tab > set Indent to 0 and uncheck Merge cells.
How do I reset column width back to default after autofitting?
Select the column(s), go to Home > Format > Column Width, and enter 8.43 (the default width for the Normal style). On Mac, use 9 as the default.
Does autofit affect print layout?
Yes—autofit changes the on-screen width/height, which carries over to print. For better print results, use Page Layout > Scale to Fit or manually set print area margins after autofitting.
Can I autofit cells using a macro?
Yes. Use the VBA command Columns("A:D").AutoFit for columns or Rows("1:10").AutoFit for rows. To apply to the entire sheet, use Cells.AutoFit. Save the file as .xlsm to preserve macros.