IMAGE function in Google Sheets
IMAGE shows a picture from a web address inside a cell.
IMAGE puts a picture inside a cell, so that it moves, sorts and filters with its row. A product list can carry a photo of each item. A staff directory can show faces. Because it is a formula, a column of web addresses becomes a column of pictures at once.
No results are shown here, since the result is a picture and depends on a real address.
Syntax
=IMAGE(url, [mode], [height], [width])| Argument | What it is |
|---|---|
url | The web address of the picture, starting with https, in quotation marks or in a cell. |
mode | 1 fits the picture inside the cell and keeps its shape (the default). 2 stretches it to fill the cell. 3 shows it at its real size. 4 uses the height and width you give. |
height, width | For mode 4: the size in pixels. |
Examples
=IMAGE("https://www.example.com/logo.png")Result: depends on live data or changes each timeThe picture at that address, fitted inside the cell. (The address is a placeholder.)
=IMAGE(A2)Result: depends on live data or changes each timeThe address taken from a cell. Copied down a column of addresses, it shows a picture on every row.
=IMAGE(A2,2)Result: depends on live data or changes each timeMode 2: stretched to fill the cell, ignoring the picture's proportions.
=IMAGE(A2,3)Result: depends on live data or changes each timeMode 3: real size. The picture is cut off if the cell is smaller.
=IMAGE(A2,4,60,60)Result: depends on live data or changes each timeMode 4: exactly 60 pixels high and 60 wide.
=IF(A2="","",IMAGE(A2))Result: depends on live data or changes each timeA guard for rows with no address.
How it works
Give the full web address of an image file. Sheets fetches the picture and draws it in the cell. Make the row taller and the column wider to see it at a useful size. The picture scales with the cell in modes 1 and 2.
The four modes
| Mode | Behaviour | Use it for |
|---|---|---|
| 1 | fits inside the cell, shape kept | most cases |
| 2 | stretched to fill the cell | backgrounds, colour swatches |
| 3 | original size, cropped if too big | small icons |
| 4 | the size you state | uniform thumbnails |
The address must be public
Sheets' servers fetch the picture, so it has to be reachable by anyone on the internet without signing in.
- The address must start with
https://. - It should point straight at an image file, usually ending in .png, .jpg, .gif or .webp, not at a web page that contains the picture.
- A picture kept privately in Google Drive does not work through its ordinary sharing link.
If the cell stays empty or shows an error, open the address in a private browser window. If the picture does not appear there by itself, IMAGE cannot show it either.
Formula or inserted picture?
Sheets has two other ways to add a picture.
- Insert, Image, Insert image in cell places an uploaded picture in a cell. It is stored in the file and needs no web address.
- Insert, Image, Insert image over cells floats the picture above the grid. It does not belong to any row.
Use the IMAGE function when you already have web addresses, when the list is long, or when the pictures should change as the addresses change. Use the menu for a logo or a one-off picture.
A QR code or chart in a cell
IMAGE can show anything that a web address returns as a picture, including images generated on request by a web service from values in the sheet. If you build an address from cell values this way, remember that those values are sent to that service. Use only services you trust, and never send private data in an address.
In lists and lookups
Because the picture is the result of a formula, it can be looked up. =VLOOKUP(E2, A2:C50, 3, FALSE), where column C holds IMAGE formulas, returns the picture for the chosen item. That is the basis of a simple catalogue page: pick a code from a drop-down and see the item's photo.
Speed
Each IMAGE cell is a separate download. A few dozen are fine. Hundreds make a sheet slow to open, and the pictures appear one by one. Use small image files.
Common mistakes
- An address that leads to a web page, not to the picture file.
- A picture that needs a sign-in.
- An
httpaddress without the s. - A row too short to see the picture.
- Expecting the picture to be saved in the file. Only the address is. If the picture is removed from the web, the cell goes blank.
In Excel
Microsoft 365 has an IMAGE function with a similar purpose and different arguments. Excel 2021 and earlier have none. Pictures made by the Sheets formula do not carry over to an Excel file.
Related functions
- SPARKLINEOnly in Sheets
- IMPORTHTML, IMPORTXML and IMPORTDATAWeb and import
- IF and IFSLogical
- ARRAYFORMULAOnly in Sheets
The results on this page were worked out by us from the sample sheet; they were not produced by a script running Google Sheets. If Sheets shows you something different, please tell us.
This is an independent help site. It is not connected with or approved by Google. Google Sheets is a trademark of Google LLC, named here only to say which program a formula is for. The people and figures in the sample sheets are made up.