To autofit columns in Excel, select the column(s) you want to adjust, then double-click the right edge of any selected column header (the line between column letters). Alternatively, use the ribbon: Home > Format > AutoFit Column Width, or press Alt+H+O+I on Windows (Control+Option+O+I on Mac).
What Autofit Actually Does
Autofit resizes a column to the width of its longest visible content. Excel calculates the widest cell value in the column—including text, numbers, and dates—and expands or shrinks the column so everything fits without spilling into adjacent cells or showing “###” for numbers. This is different from manually dragging the column edge, which sets a fixed width that stays the same even if you later enter longer text.
Important: Autofit only considers the content that is currently in the column. If you add new data after autofitting, the column won’t automatically update—you’ll need to run autofit again. Also, if a cell contains a wrapped text (via Home > Wrap Text), autofit will adjust the column width to fit the longest line of that wrapped text, but it won’t change the row height automatically unless you also autofit the row.
Method 1: Double-Click the Column Boundary
The fastest way is the mouse method:
- Move your cursor to the header row (the row with letters A, B, C, etc.).
- Position the cursor on the vertical line between two column letters (e.g., between A and B). The cursor changes to a double-headed arrow (↔).
- Double-click. The column to the left of the line autofits.
To autofit multiple columns at once, select them by clicking and dragging across the column letters (or hold Ctrl and click to select non-adjacent columns), then double-click any boundary between the selected columns. All selected columns will autofit to their own content.
On a Mac, the same double-click works. On Excel for the web (browser), double-clicking the boundary also works, but you may need to hover precisely to see the resize cursor.
Method 2: Use the Ribbon (Format Menu)
If you prefer the menu path:
- Select the column(s) you want to adjust.
- Go to the Home tab.
- In the Cells group, click Format.
- Choose AutoFit Column Width.
This applies the same autofit logic. On a Mac, the path is identical: Home > Format > AutoFit Column Width. In Excel for the web, the Format button is also on the Home tab, but it may be labeled “Format” with a dropdown arrow.
Method 3: Keyboard Shortcuts
Keyboard users can do it without touching the mouse:
- Windows: Select the column(s), then press
Alt+H+O+I. This triggers Home > Format > AutoFit Column Width. - Mac: Select the column(s), then press
Control+Option+O+I.
Note: The Mac shortcut uses the Option key, not Alt. If you’re using a Mac keyboard with a Windows layout, the Alt key may work, but the standard Mac shortcut is as above.
How to Autofit All Columns in a Sheet
Sometimes you want every column to fit its content. To autofit all columns at once:
- Click the small triangle at the top-left corner of the sheet (where the row numbers meet the column letters) to select the entire sheet. Or press
Ctrl+A(Windows) orCommand+A(Mac) twice if the active cell is empty. - Double-click any column boundary, or use the ribbon Format > AutoFit Column Width.
This will adjust every column based on its own content. Be cautious: if you have a cell with a very long text string (like a paragraph), the column will become extremely wide, making the sheet unwieldy. In such cases, consider using Wrap Text and manually setting a reasonable column width instead.
Common Problems and Misconceptions
“###” instead of numbers: If a column shows hashes (###), it means the column is too narrow to display the number. Autofit will fix this. However, if the cell format is set to a date or time that doesn’t fit, autofit may not help if the column width is already at its maximum (255 characters). In that case, change the number format or merge cells.
Autofit doesn’t work for merged cells: Excel will not autofit a column that contains merged cells. If you have merged cells in the column, you’ll need to unmerge them, autofit, then re-merge—or manually set the width.
Autofit ignores hidden rows: If you have hidden rows, autofit only considers visible cells. Hidden rows’ content is not factored in, which can result in a column that’s too narrow when you later unhide the rows.
Autofit does not affect row height: Column autofit only changes width. If you have wrapped text and want the row height to adjust, you need to autofit the row (Home > Format > AutoFit Row Height or double-click the row boundary).
When Not to Use Autofit
Autofit is great for quick fixes, but it’s not always the best choice. If you have a column with a few very long entries (like a full address) and many short ones, autofit will make the column extremely wide, leaving lots of empty space. In that case, consider:
- Wrap Text: Select the cell(s), go to Home > Wrap Text. This wraps the text to multiple lines, keeping the column narrow. You’ll then want to autofit the row height to show all lines.
- Shrink to Fit: Right-click the cell, choose Format Cells > Alignment, and check “Shrink to fit.” This reduces the font size to fit the column width—useful for long numbers or text that must stay in one line.
- Set a fixed width: If you want consistent column widths for a professional look, manually drag the boundary or set a specific width (Home > Format > Column Width).
Frequently Asked Questions
Does autofit work on merged cells? No. Excel cannot autofit a column if any cell in that column is merged. You’ll need to unmerge the cells, autofit, then re-merge. Alternatively, set a manual width that fits the merged content.
Why does autofit not work when I double-click? Double-clicking the boundary only autofits if the column is not protected. If the sheet is protected (Review > Protect Sheet), you must unprotect it first. Also, if the column contains merged cells, autofit is disabled.
Can I autofit a column to a specific width? Autofit always adjusts to the content. If you want a specific width, use Home > Format > Column Width and enter a number (in characters). The default width is 8.43 characters.
Does autofit work in Google Sheets? Yes, but differently. In Google Sheets, you can double-click the column boundary to autofit, or go to Format > Resize columns > Fit to data. The keyboard shortcut is not the same as Excel’s.
Will autofit affect row height? No, column autofit only changes width. To adjust row height to fit wrapped text, double-click the row boundary or use Home > Format > AutoFit Row Height.
How do I autofit all columns in a specific range only? Select the range (e.g., A1:D10), then double-click a boundary within the selection. Only the columns in that selection will autofit, and only based on the content in that range—not the entire column.
Related
- How to Convert Text to Numbers in Excel
- COUPDAYBS in Google Sheets: How It Works
- Google Sheets Table Filter: How to Use It
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Split Part in SOLIDWORKS: How to Divide and Save BodiesTo split a part in SOLIDWORKS, use Insert > Features > Split, choose a plane, surface, or suitable…
- How to Delete Track Changes in Word and Accept EditsTo remove tracked edits in Microsoft Word, save a copy of the document, then go to Review >…
- COUPDAYSNC in Google Sheets: Days to Next CouponThe COUPDAYSNC function in Google Sheets calculates the number of days from a settlement date to the next…
- Data Entry for Teens: Real Jobs & PayYes, teens can find legitimate data entry jobs, but most are part-time, freelance, or entry-level positions that pay…
- Cannot Close Excel Because a Dialog Box Is Open? FixesIf Excel says it cannot close because a dialog box is open, find and respond to that open…
- MP Materials Balance Sheet: Key Financials ExplainedMP Materials (NYSE: MP) is a rare earth mining and processing company, and its balance sheet as of…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.