<Image> component extends the HTML <img> element with automatic optimization:
- Size optimization — automatically serves correctly sized images for each device using modern formats like WebP.
- Visual stability — prevents Cumulative Layout Shift while images load.
- Faster page loads — lazy-loads images by default using native browser lazy loading, with optional blur-up placeholders.
- Asset flexibility — resizes images on demand, even from remote servers.
Basic usage
ImportImage from next/image and render it in your component:
Local images
Store static files like images under apublic folder in the project root. Files inside public are accessible from the base URL (/).
When you statically import an image, Next.js automatically determines its intrinsic
width and height from the file. These values prevent layout shift while the image loads.Remote images
To use a remote image, provide a URL string forsrc:
width, height, and optionally blurDataURL manually.
Allowing remote patterns
To safely allow images from remote servers, define the permitted URL patterns innext.config.js:
Props
Required props
The image source. Either a path string (for local files in
public/ or remote URLs) or a statically imported image file.Describes the image for screen readers and search engines. Use an empty string (
alt="") for decorative images.Sizing props
The intrinsic width of the image in pixels. Required for remote images unless
fill is used. Omit for statically imported images (auto-detected).The intrinsic height of the image in pixels. Required for remote images unless
fill is used. Omit for statically imported images (auto-detected).Causes the image to fill the parent element. The parent must have
position: relative, position: fixed, or position: absolute. Useful when the image dimensions are unknown.A string similar to
media queries that provides information about how wide the image will be at different breakpoints. Greatly affects performance for images using fill or styled to be responsive.Example: "(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"Optional props
Optimization quality for lossy formats. An integer between
1 and 100.When
true, the image is preloaded. Useful for the largest image in the initial viewport (similar to the deprecated priority prop).The loading behavior.
'lazy' defers loading until the image is near the viewport. 'eager' loads immediately.The placeholder to show while the image loads.
'blur'— usesblurDataURLas the placeholder (auto-generated for static imports).'empty'— no placeholder.'data:image/...'— a custom Data URL used as the placeholder.
A base64-encoded Data URL used as the blur placeholder when
placeholder="blur". Required for remote images when using blur placeholders.When
true, the image is served as-is without changing quality, size, or format. Useful for images that are already optimized.A custom function used to resolve image URLs. Overrides the default Next.js image loader.
Fill mode
Usefill to make an image expand to cover its parent container. The parent must have a defined size and position: relative:
app/page.tsx
Priority loading
For images that appear above the fold (such as a hero image or the largest element on the page), setpreload to true to avoid lazy loading:
app/page.tsx
