images (next.config)
Configures next/image: allowed remote hosts, formats, and sizes.
Syntax
images: { remotePatterns, formats, deviceSizes, ... } Parameters
| Name | Type | Required | Description |
|---|---|---|---|
images | ImageConfig | No | `remotePatterns`, `formats`, `deviceSizes`, `imageSizes`, `minimumCacheTTL`, `loader`, `unoptimized`. |
Returns
NextConfig — Image optimization settings.
Examples
const nextConfig = {
images: {
remotePatterns: [
{
protocol: 'https',
hostname: '**.example.com',
pathname: '/images/**',
},
],
formats: ['image/avif', 'image/webp'],
},
}
module.exports = nextConfig
// Use a custom loader / disable optimization
const nextConfig = {
images: {
unoptimized: true,
},
}
module.exports = nextConfig
Notes
Remote images must match `remotePatterns` (the old `domains` array is
deprecated). `formats` controls negotiated output (AVIF first is
smaller but slower to encode). `deviceSizes`/`imageSizes` shape the
generated srcset. Use a custom `loader` for external CDNs or
`unoptimized` for static export.