In Microsoft Excel, there are multiple easy ways to automatically adjust columns and rows to fit the width and height of text.
This is a really handy trick that makes it easy to ensure that the text / data in your spreadsheet is viewable, and it saves you lots of time from having to manually adjust column width and row height.
When you use the AutoFit option, columns and rows will shrink and expand automatically so that the columns fit the longest string of text in each column, and so that the rows fit the largest text height.
To AutoFit column width (automatically resize columns) in Microsoft Excel, hover your cursor over the right border at the top of the column that you want to autofit (the border to the right of the column letter), and double-click when the double-headed arrow appears (the arrow means that Microsoft Excel is ready to resize columns).
To AutoFit row height (automatically resize rows) in Microsoft Excel, hover your cursor over the bottom border on the left of the row that you want to autofit (the border below the row number), and double-click when the double-headed arrow appears (the arrow means that Microsoft Excel is ready to resize row).
Or, you can also use the method described below.
To AutoFit column width in Microsoft Excel, follow these steps:
- Select the column(s) that you want to automatically resize
- Click “Format” on the top toolbar / ribbon
- Click “Auto Fit Column Width”
Now your columns will have adjusted so that the width of the columns fits the text in each column.
To AutoFit row height in Microsoft Excel, follow these steps:
- Select the row(s) that you want to automatically resize
- Click “Format” on the top toolbar / ribbon
- Click “Auto Fit Row Height”
Below you will find detailed instructions and examples on how to automatically resize column width and row height. But first, let’s go over the “Auto Fit” shortcut.
This lesson focuses on how to automatically adjust columns and rows in an Excel spreadsheet, and the method for Google Sheets is similar but has important differences, so click here if you want to learn how to automatically adjust column width in Google Sheets.
Microsoft Excel AutoFit shortcuts for columns and rows
The easiest way to automatically resize column width and row height in Microsoft Excel is to use the AutoFit shortcuts:
- The first shortcut is the method that allows you to double-click the boundary between columns and rows to automatically adjust the column width / row height.
- The second shortcut is the keyboard shortcut that activates AutoFit.
My preferred shortcut is the double-click method, but you can also use a keyboard shortcut if you prefer.
Double-click shortcut to AutoFit column width and row height
When using the AutoFit shortcut, instead of clicking and dragging your cursor to manually adjust column width or the row height… all you have to do is double-click to fit the column width / row height to the text in the cells.
To use the AutoFit shortcut to autofit column width in Microsoft Excel, follow these steps:
- Hover your cursor at the top-right of the column that you want to adjust the width of (or the top-right of one of multiple selected columns), over the boundary between the columns. Your cursor will turn into double headed arrows (arrows that point left and right)
- Double-click your mouse while the double-headed arrows are displayed, and your column will automatically adjust to fit the length of text
To use the AutoFit shortcut to autofit row height in Microsoft Excel, follow these steps:
- Hover your cursor at the bottom-left of the row that you want to adjust the height of (or the bottom-left of one of multiple selected rows), over the boundary between the rows. Your cursor will turn into double headed arrows (arrows that point up and down)
- Double-click your mouse while the double-headed arrows are displayed, and your row will automatically adjust to fit the height of the text
Keyboard shortcuts to AutoFit columns and rows in Excel
If you want, you can use keyboard shortcuts to autofit column width or autofit column height in Excel. These keyboard shortcuts are a sequence of keys on the keyboard that open the appropriate menus and select the desired option. Note that these keyboard shortcuts do not work in Excel online.
Auto Fit column width keyboard shortcut:
“Alt + H”, then “O”, and then “I“
Auto Fit row height keyboard shortcut:
“Alt + H”, then “O”, and then “A“
- Alt + H takes you to the “Home” tab
- “O” opens the “Format” menu
- “A” selects “Auto Fit Row Height”
- “I” selects “Auto Fit Column Width”
After pressing “Alt” you will see letters pop up on the top toolbar / ribbon which will help show you the key to press to activate each button via your keyboard. So if you forget the shortcut you can simply press “Alt” and choose the desired options / press the appropriate keys from there.
To autofit column width by using the keyboard shortcut, select the columns that you want to adjust, then press “Alt + H” then “O” then “I” on the keyboard.
To autofit row height by using the keyboard shortcut, select the rows that you want to adjust, then press “Alt + H” then “O” then “A” on the keyboard.
AutoFit columns example
In this example, we have text in the cells that is too long to fit inside the cells / columns (the text is cut off on the right side of the cells).
To make the cells fit the text, select the columns that you want to adjust, hover the cursor at the top of one of the selected columns over the boundary / border between the columns where a double-headed arrow will appear, then double-click (as shown in the example image below).
After using the double-click AutoFit Column Width shortcut, the columns will adjust to fit the text inside the cells, as shown in the example image below.
If you only need to adjust a single column, you do not need to select the column before using the double-click shortcut.
If you select multiple columns, you can double-click at the top-right border of any of the selected columns to adjust them all at once.
AutoFit rows example
In this example, we have text in the cells that is too tall to fit inside the cells / rows (the text is cut off on the top / bottom of the cells).
To make the cells fit the text height, select the rows that you want to adjust, hover the cursor on the left of one of the selected rows over the boundary / border between the rows where a double-headed arrow will appear, then double-click (as shown in the example image below).
After using the double-click Auto Fit Row Height shortcut, the rows will adjust to fit the height of the text inside the cells, as shown in the example image below.
If you only need to adjust a single row, you do not need to select the row before using the double-click shortcut.
If you select multiple rows, you can double-click at the bottom-left border of any of the selected rows to adjust them all at once.
Below I will teach you how to autofit the width / height of single columns and rows, and then I will also show you how to adjust multiple columns and rows at once.
If you want, you can make the cells in your spreadsheet automatically fit the text in a different way, where the text will go to a new line when it reaches the end of the column/cell, and the row height will automatically adjust when a new line is added each time. This is called text wrapping.
To wrap text, select the cell(s) that you want to wrap, and then click “Wrap Text” on the top toolbar / ribbon.
How to fit cell width to text in Microsoft Excel
Now let’s look at an example of fitting cell width to text. In this section we will go over the instructions in greater detail.
In this example, we have contact information that is entered into column A, but the text is too long to fit inside the cells. We will use “Auto Fit Column Width” to make the column width fit the longest / widest string of text.
Follow these steps to AutoFit columns in Microsoft Excel:
Step 1: If you have multiple columns to adjust, select the columns that you would like to adjust
Step 2: Use any of the of the methods listed below to use “Auto Fit Column Width”:
Method 1:
- Press “Alt + H”, then “O”, and then “I” on the keyboard
Method 2:
- Click “Format” on the top toolbar / ribbon
- Then click “Auto Fit Column Width”
Method 3:
- Double-click on the top-right (border) of the column that you want to adjust the width of automatically
(Notice the horizontal “double-headed” arrow at the top of the column in the picture below (Between columns A and B). This is how your cursor will look when it is time to double-click your mouse to use the AutoFit shortcut.)
As you can see in the image below, after using “Auto Fit Column Width” column A has expanded to fit the longest / widest string of text in that column.
Now the contact information fits inside the cells and is not cut off anymore.
How to fit cell height to text in Microsoft Excel
Now let’s look at an example of fitting cell height to text.
In this example, we have a list of addresses that are entered into column A, but the text is too tall to fit inside the cells. We will use “Auto Fit Row Height” to make the row height fit the text height.
Follow these steps to AutoFit rows in Microsoft Excel:
Step 1: If you have multiple rows to adjust, select the rows that you would like to adjust
Step 2: Use any of the of the methods listed below to use “Auto Fit Row Height”:
Method 1:
- Press “Alt + H”, then “O”, and then “A” on the keyboard
Method 2:
- Click “Format” on the top toolbar / ribbon
- Then click “Auto Fit Row Height”
Method 3:
- Double-click on the bottom-left (border) of the row that you want to adjust the height of automatically
(Notice the horizontal “double-headed” arrow at the top of the column in the picture below (Between rows 2 and 3). This is how your cursor will look when it is time to double-click your mouse to use the AutoFit shortcut.)
As you can see in the image below, after using “Auto Fit Row Height” the rows have expanded to fit the height of the text.
Now the address data fits vertically inside the cells and is not cut off anymore on the top or bottom.
Notice in the image above that although we have successfully adjusted the row height, the width of column A still needs to be expanded. Sometimes you will need to adjust both row height and column width to allow the data to display inside of the cells.
For the remaining examples in this lesson, I will use the double-click shortcut method, but if you prefer to use the other methods that we have discussed (keyboard shortcut or the button on the ribbon), each of these methods will achieve the same result.
How to expand columns and rows to fit text in Microsoft Excel
Now let’s go over an example of adjusting multiple columns at one time, to automatically fit the text that is entered in them.
In this example we have information about varying hotels entered into columns A through F.
For several of the columns, in both the header and the rows below the header, that text is too long to fit inside the cell / column.
We are going to automatically resize the columns so that the width of the column fits the text in the cells. To do this follow the instructions below.
Start by selecting columns A through F.
To select multiple columns, click on the letter at the top of the first column you want to select, hold your click and drag your cursor right until you reach the letter of the last column that you want to select, then release your click.
Another way that you can select multiple columns, is to click on the first column that you want to select, then hold the “Shift” key on the keyboard and press the right arrow key to select additional columns.
The top of each selected column will turn dark green, and the cells in the columns will be highlighted with green color.
Now hover your cursor over the border between two of the selected columns, at the very top of the columns near the column letters.
When your cursor is in the correct position to adjust column width, the cursor will appear as a set of arrows (double-headed arrow) which point left and right (or up and down for adjusting rows).
But instead of clicking and dragging your cursor to adjust the columns manually, we will use the double-click AutoFit shortcut to adjust them automatically.
Now double-click your mouse, and the column width will automatically adjust to fit the text in each column.
In the image below you can see that some of the columns expanded and some of them became more narrow, because each individual column was adjusted according to the longest string of text entered in the column.
Now you can see all of the headers as well as all of the text that is entered into the cells below, such as the notes that were reported about each hotel.
The same thing will happen when you adjust rows where some of the rows have larger/taller text than the other rows. Each individual row will adjust to the largest text in the row. When you autofit the height of multiple rows, the rows that have extra space will become shorter and the rows that require more space will become taller.
How to shrink columns and rows to fit text in Microsoft Excel
The AutoFit option in Microsoft Excel is also useful for shrinking columns and rows to fit text (not just expanding).
For example, when teachers track attendance or grades, they often want narrow columns so that many columns fit within the screen view.
When the text inside of the columns is narrow / short and you use autofit to automatically adjust the columns, the columns will shrink to fit the text and the columns will become narrow… which allows more columns to be seen in a single screen view.
In the example image below you can see that the columns are wider than they need to be to fit the attendance data, and so we can use “Auto Fit Column Width” to automatically adjust the column width to fit the text in the cells.
To shrink the columns to fit the attendance data in this example, follow these steps:
- Select columns B through J (or select all of the columns)
- Double-click on the border between any of the selected columns (at the very top of the columns near the column letter), to use the “Auto Fit Column Width” shortcut
After using autofit, the columns have narrowed to fit the attendance data inside of each column. Now more columns fit on the screen, and the attendance data looks more compact like we wanted.
Autofit column width to fit headers in Microsoft Excel
Another example of when autofit is useful, is when your headers are too long to fit inside the default column width.
In this example, the header text in row 1 is being cut off on the left and right because the text is too long to fit inside the cells/columns.
If the text is too long and left aligned, it will be cut off on the right. If the text is center aligned, it will be cut off on both the left and the right. If the text is right aligned, the text will be cut off on the left.
To make the column width fit the header text in this example, follow these steps:
- Select columns A through G (or select all of the columns)
- Double-click on the boundary between any of the selected columns (at the top of the columns near the column letters)
After using autofit, the columns became wider to fit the header text in row 1, as shown in the example image below.
How to resize all columns and rows to fit in Microsoft Excel
Let’s take a look at one more example, where we will automatically adjust the column width to fit the text in the cells, but in this example we will resize all of the columns to fit the text.
You can select all columns and rows in your Excel spreadsheet by pressing “Ctrl” + “A” on the keyboard.
In this example we have duration data that was recorded in a series of time trials.
We will use AutoFit to resize every column, and since in this case the columns are wider than they need to be, the columns will become more narrow.
To resize all columns in Microsoft Excel, follow these steps:
- Select every column in your spreadsheet (press “Ctrl” + “A” on the keyboard)
- Click “Format” on the top ribbon, and then click “Auto Fit Column Width”
- Or, if you want, you can use the autofit shortcut: Double-click on the barrier between any of the selected columns (at the top of the columns above row 1)
As you can see in the image below, the recorded duration values are all the same length / same number of characters, and so the columns have all shrunk down to the same width after applying “Auto Fit Column Width”.
Now you know all of the different ways to automatically resize column width and row height in your Excel spreadsheet!
Pop Quiz: Test your knowledge
Answer the questions below about how to AutoFit column width in Excel, to refine your knowledge! Scroll to the very bottom to find the answers to the quiz.
Question #1
True or false: When adjusting the size of a column, double-clicking on the border at the top-right of the column will adjust the column width to automatically fit the text
- True
- False
Question #2
True or false: The AutoFit menu option does the same thing as that the double-click shortcut does
- True
- False
Question #3
How many columns and rows can be adjusted simultaneously to automatically fit the text inside the cells?
- Only 1 at a time
- 2
- As many columns and rows as you want
Question #4
True or false: “Auto Fit Column Width” will only expand a column, and will not make it thinner
- True
- False
Answers to the questions:
Question 1: 1
Question 2: 1
Question 3: 3
Question 4: 2