How to Use the IMAGE Function in Microsoft Excel to Insert Images in Cells

Building visual product catalogues, employee directories, real estate portfolios, and inventory trackers in Microsoft Excel historically presented a formatting headache. Images inserted via standard menus floated as detached graphical layers hovering awkwardly above grid cells. When rows were sorted, filtered, hidden, or resized, floating pictures would drift out of alignment, overlap text, or bunch together in chaotic stacks. Microsoft solved this limitation with the introduction of the native IMAGE function. The IMAGE function embeds graphics directly inside the cell structure, allowing images to sort, filter, and resize alongside spreadsheet data dynamically.

Understanding the Syntax of the IMAGE Function

The IMAGE function takes a direct URL reference and renders the image inside the designated cell boundaries.

The standard syntax structure is:

=IMAGE(source, [alt_text], [sizing], [height], [width])

Let’s examine each parameter:

  • source: The valid web URL of the image file (must use secure https:// protocol). Supported formats include JPEG, PNG, WEBP, GIF, TIFF, and BMP.
  • alt_text (optional): Accessible alternative text describing the graphic for screen readers and accessibility audits.
  • sizing (optional): Governs how the image scales relative to cell boundaries:
    • 0: Fit to cell, maintaining aspect ratio (default).
    • 1: Fill cell, stretching the image to ignore aspect ratio.
    • 2: Original size, which may clip if the image exceeds cell dimensions.
    • 3: Custom size, which requires specifying the explicit height and width arguments.
  • height (optional): Explicit height in pixels (used only when sizing mode is set to 3).
  • width (optional): Explicit width in pixels (used only when sizing mode is set to 3).

Step-by-Step: Inserting a Basic In-Cell Image

To render an image inside a cell:

  1. Confirm your image is hosted online via a secure link (for example, https://example.com/products/headphones.png).
  2. Select the target cell where the picture should appear (e.g., cell B2).
  3. Enter the formula:
=IMAGE("https://example.com/products/headphones.png", "Wireless Headphones")
  1. Press Enter. Excel fetches the image stream and displays it neatly constrained within the cell boundaries.
  2. Drag the row height or column width: the image automatically scales proportionally to fit the expanding or contracting cell.

Dynamic Catalogues: Combining IMAGE with XLOOKUP and Formulas

Because the IMAGE function accepts cell references as its source argument, you can construct dynamic e-commerce inventories:

If column A contains Product IDs and column D contains image URLs:

=IMAGE(D2, "Product " & A2)

To create a dynamic search dashboard where entering an SKU in cell F2 automatically pulls the correct product photo into cell F3:

=IMAGE(XLOOKUP(F2, A2:A100, D2:D100), "Product Photo")

Whenever you update the SKU in cell F2, XLOOKUP retrieves the matching URL, and the IMAGE function renders the updated picture instantly.

IMAGE Function Sizing Modes Reference

Sizing Value Scaling Mode Aspect Ratio Preserved? Typical Use Case
0 Fit image to cell Yes (proportional) Product catalogues, inventory listings (standard)
1 Fill cell completely No (distorts to fit) Full-bleed background colour blocks
2 Original native resolution Yes (unscaled) Icons, logos that should remain 1:1 pixel scale
3 Custom pixel dimensions Depends on height/width Standardising uneven image sets to exact 100×100 px

Troubleshooting Common IMAGE Formula Errors

If the IMAGE function outputs an error badge instead of rendering the graphic, inspect these potential issues:

  • #CONNECT! Error: Excel cannot reach the hosting server. Ensure your computer is connected to the internet and verify the URL is not blocked by a corporate firewall.
  • HTTP vs HTTPS: The source URL must strictly start with https://. Insecure http:// links are rejected for security reasons, returning a #VALUE! error.
  • Authentication Barriers: The image URL must be publicly accessible or shareable without requiring a login cookie. Links pointing behind password-protected portals (such as private Google Drive or OneDrive internal viewer links) fail to render.
  • Supported File Types: Ensure the link terminates in a supported raster extension (.png, .jpg, .webp). Vector SVG formats are currently unsupported by the IMAGE function.

Frequently Asked Questions

Can I filter and sort tables containing in-cell images?

Yes. Because the image is an intrinsic property of the cell, sorting rows alphabetically by name or filtering out out-of-stock items moves the corresponding images with their rows with zero drift.

Can I copy an image from my desktop hard drive directly into an IMAGE formula?

The IMAGE function requires an HTTP/HTTPS URL and cannot read local disk paths like C:\Photos\image.png. To insert a local image into a cell without formulas, click Insert > Pictures > Place in Cell > This Device.

Which versions of Microsoft Excel support the IMAGE function?

The IMAGE function is supported in Microsoft 365 (Windows, Mac, iOS, Android, and Web) and Excel 2024. It is not supported in legacy standalone releases such as Excel 2019 or Excel 2016.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.