To resize a column to fit its contents in Excel for Microsoft 365 on Windows, select the column or cells in it, then press Alt, H, O, I in sequence. To enter a precise width instead, press Alt, H, O, W, type the width, and press Enter. These ribbon shortcuts can make a crowded worksheet easier to read without dragging column borders by hand.
What You’ll Need
- Excel for Microsoft 365 on a Windows computer, with the workbook open.
- A keyboard. The steps below use Excel ribbon KeyTips, so press and release each key in order rather than holding the whole sequence down.
- Permission to edit the worksheet. A protected sheet may prevent you from changing column widths.
If you use Excel for Mac or Excel for the web, the same resizing options are available, but the shortcut and ribbon behavior can differ. Those differences are covered below.
Step-by-Step
- Choose what you want to resize. To change one entire column, click its letter at the top of the worksheet, such as B. To choose several adjacent columns, click the first letter and drag across the other letters, or click the first letter, hold Shift, and click the last. To choose nonadjacent columns, hold Ctrl while clicking each letter. You can also select one or more cells in the columns; AutoFit will apply to the corresponding column or columns.
- AutoFit a column to its contents. Press and release Alt, then press H, O, and I, one after another. The sequence opens Home ribbon commands and chooses AutoFit Column Width. Excel adjusts each selected column to accommodate its contents, using the current cell formatting. For example, if column B contains product names and one name is longer than the others, AutoFit widens B to make that entry visible.
- Check the result and repeat for other columns if needed. AutoFit works separately on every selected column. If a wide description column becomes awkwardly large, undo the change with Ctrl+Z and use a chosen width instead. Remember that a cell containing a long sentence can make a whole column wide, even if most other cells contain short values.
- Set a specific width with the keyboard. Select the target column or columns, then press Alt, H, O, W in sequence. The Column Width dialog opens. Type a number and press Enter. For instance, entering 15 sets the selected columns to a width of 15 Excel character units. The unit is based on the width of characters in the workbook’s default font; it is not a measurement in pixels or inches.
- Use the ribbon if KeyTips are unavailable. Select the columns, then choose Home > Format > AutoFit Column Width to fit contents, or Home > Format > Column Width to type a value. Ribbon wording or layout can vary slightly with window size, but both commands are in the Home tab’s Format menu in desktop Excel for Windows.
- Resize by dragging when visual control matters. Move the pointer to the divider between two column letters, such as between B and C. When the pointer changes to a horizontal resize cursor, drag the divider left or right. Double-clicking that divider AutoFits the column. This is useful for a quick adjustment, although it is not a keyboard shortcut and can be less precise than entering a width.
- Confirm that the content is readable. Look for clipped text, unwanted gaps, and columns that have become excessively wide. A numeric value displayed as hash marks may need more width, but a date or number may also need an appropriate number format. Resizing changes the column, not the underlying value or its format.
On Mac: Select the column, then use Option+Command+0 to AutoFit Column Width in Excel for Mac, where that shortcut is available. Some macOS keyboard settings can intercept it; use Home > Format > AutoFit Column Width if it does not work. To set an exact value, choose Home > Format > Column Width and enter the number. On many Mac keyboards, you may need to press Fn along with a key if a shortcut uses a function key, but the AutoFit shortcut above does not require one.
In Excel for the web: Ribbon KeyTips and keyboard sequences can depend on the browser and its shortcut settings. If Alt, H, O, I does not open the command, select the columns and use Home > Format > AutoFit Column Width. Choose Home > Format > Column Width to enter a specific value. If a browser captures a key combination, use the ribbon rather than repeatedly pressing the shortcut.
Common Mistakes
- Holding the keys together. On Windows, Alt, H, O, I is a sequence of KeyTips, not a four-key chord. Press and release each key, waiting for the ribbon to show the next available KeyTip where applicable.
- Selecting cells when you meant to resize different columns. AutoFit affects the columns containing the selected cells. If you select B2:B10, Excel adjusts column B; it does not adjust row heights. Check the selected column letters before running the command.
- Expecting AutoFit to choose a comfortable layout. AutoFit aims to show the cell contents, not to create a compact report. One long text entry can widen the whole column. Consider a fixed width, text wrapping, or a wider page layout instead.
- Typing a width as if it were pixels. The Column Width dialog uses Excel’s character-based width units. A value of 15 does not mean 15 pixels. Use the preview and adjust the number until the layout suits your worksheet.
- Confusing column width with row height. Alt, H, O, I is AutoFit Column Width. It does not make wrapped text’s row taller. To fit row height, select the relevant rows and use Home > Format > AutoFit Row Height.
- Relying on AutoFit for merged cells. Excel may not AutoFit a column correctly when the relevant content is in a merged cell. Set the width manually or adjust the merged layout; avoid merging cells simply to make a heading appear centered across columns.
Tips
- AutoFit several columns in one go. Select the column letters you want, then run Alt, H, O, I once. Each selected column gets its own suitable width; Excel does not make all of them the same width. Use the Column Width dialog instead if uniform widths are the goal.
- Select the whole worksheet when appropriate. Click the small triangle at the intersection of the row numbers and column letters, then run AutoFit. This adjusts all columns, but it can make the sheet much wider if it contains long notes or labels. Save first or be ready to undo if the result is not useful.
- Use wrapping for paragraphs. If a column contains notes or addresses, choose Home > Wrap Text and set a reasonable width. Wrapped text occupies additional lines within the cell, so you may also need Home > Format > AutoFit Row Height. AutoFit Column Width alone is not always the best presentation for long paragraphs.
- Keep related columns consistent. For a simple table, select a group of columns and set one width with Alt, H, O, W. This can make headers and data easier to scan. If values need different amounts of space, AutoFit them individually or select only the columns that should share a width.
- Know how to undo. If a shortcut changes more than intended, press Ctrl+Z on Windows immediately. On Mac, use Command+Z. Undo is especially useful after AutoFitting an entire worksheet, though it may not restore a width if later actions have changed the undo history.
- Keep the difference between resizing and hiding in mind. A very narrow column can look hidden, but it is still present. To restore it, select the columns on either side, then use Home > Format > Hide & Unhide > Unhide Columns, or drag its boundary open if you can see it.
Troubleshooting
The Windows shortcut does nothing: Confirm that Excel has focus and that you are pressing the keys in order: Alt, H, O, I. If the ribbon is minimized or the workbook is in a special mode, click a worksheet cell and try again. You can also use the Home tab’s Format menu. Some keyboard layouts or remote desktop setups may handle Alt differently, making the menu route more reliable.
The wrong column changes: Check the highlighted column letters before repeating the command. A selection of cells can cover multiple columns, and AutoFit applies to all of those columns. Press Ctrl+Z if the result is recent, select only the intended column, and retry.
The text still appears cut off: Verify the width and check for a neighboring cell containing data, which prevents text from spilling into that cell. For numbers, dates, or currency, the value may need more width or a shorter number format. If text wrapping is on, adjust row height as well as width. Also check for merged cells, which can interfere with automatic sizing.
The shortcut makes a column far too wide: Look for a long note, URL, or unusually long entry in that column. Set a smaller width through Alt, H, O, W, then use Wrap Text if the full text still needs to be visible. You can also move lengthy notes to a separate column or keep them in a cell comment or note when appropriate.
The column width command is unavailable: The worksheet may be protected, or the workbook may be open with limited editing permission. Check Review > Unprotect Sheet if you have the password or authorization, or ask the workbook owner for access. Do not attempt to bypass protection; it may be there to preserve a shared template.
Mac or browser keys trigger another feature: Try the ribbon command instead of the shortcut. On Mac, a system setting may reserve a key combination. In a browser, the browser may intercept it. Excel for the web’s ribbon remains a practical way to reach AutoFit and Column Width when keyboard behavior varies.
Frequently Asked Questions
What is the shortcut to AutoFit a column in Excel for Windows?
Press and release Alt, H, O, then I. Select the target column or cells first. Excel adjusts the selected column or columns to fit their contents.
How do I set an exact column width using the keyboard?
Select the column, press Alt, H, O, W, enter a width in the dialog, and press Enter. The width is measured in Excel’s character-based units, not pixels.
Can I resize several columns at once?
Yes. Select multiple column letters, then run AutoFit to size each one to its own contents. To give them all an identical width, select them and use the Column Width dialog instead.
Does AutoFit change row height too?
No. AutoFit Column Width changes column width. To size rows, select them and choose Home > Format > AutoFit Row Height. Wrapped text may need both an appropriate column width and row height.
What is the Excel for Mac AutoFit shortcut?
In Excel for Mac, Option+Command+0 is the AutoFit Column Width shortcut where available. If macOS intercepts it, select the column and use Home > Format > AutoFit Column Width.
Why does AutoFit make a column too wide?
Excel sizes the column to accommodate its contents, so one unusually long entry can determine the result. Set a fixed width with the Column Width command, and consider Wrap Text for long descriptions.
Related
- Paste Just Values in Excel: Keyboard Shortcuts and Steps
- How to Paste a Link in Excel as Plain Text, Not Hyperlink
- How to Paste in Excel Without Overwriting Existing Data
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Excel Data Validation List Autocomplete: How It WorksIn an up-to-date Microsoft 365 version of Excel, a data-validation dropdown can autocomplete by filtering its choices as…
- Excel Cell Adjustment Shortcut: Resize Rows and ColumnsIn Excel for Microsoft 365 on Windows, use Alt, H, O, I to AutoFit a column to its…
- Combine Cells in Excel on a New Line with CHAR(10)To combine values from A2 and B2 in one cell with a line break between them, enter =A2&CHAR(10)&B2…
- Compare Two Excel Sheets With Power QueryTo compare two Excel sheets with Power Query, turn each data range into an Excel table, import both…
- Cannot Remove a Section Break in Word? Try These FixesYes, you can remove a section break in Word: turn on formatting marks, locate the break, click immediately…
- How to Unhide Columns in Excel: Shortcut Key GuideTo unhide columns in Excel for Microsoft 365 on Windows, select the column headers on both sides of…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.