CSS image-rendering Property

The CSS image-rendering property controls how a browser interpolates image pixels when an image is scaled.

It determines whether scaled images should appear smooth or retain sharp pixel boundaries. This is especially useful for photographs, pixel art, icons, game graphics, and other images displayed at sizes different from their original dimensions.

image-rendering Syntax

The image-rendering property accepts a keyword that determines the preferred interpolation method when an image is scaled.

Basic Syntax

selector {
  image-rendering: auto;
}

Smooth Scaling

img {
  image-rendering: smooth;
}

High-Quality Scaling

img {
  image-rendering: high-quality;
}

Preserve Sharp Edges

img {
  image-rendering: crisp-edges;
}

Preserve Visible Pixels

img {
  image-rendering: pixelated;
}

CSS-Wide Keywords

img {
  image-rendering: initial;
}
img {
  image-rendering: inherit;
}
img {
  image-rendering: unset;
}
img {
  image-rendering: revert;
}
img {
  image-rendering: revert-layer;
}

The initial value is auto. Browser support differs among the non-default rendering keywords.

Property Values

Each value provides a different preference for how the browser renders an image when its display size differs from its source dimensions.

Value Description
auto Allows the browser to choose an appropriate scaling algorithm. Smooth interpolation is commonly used.
smooth Requests a smooth interpolation algorithm that blends pixel values to reduce visible blockiness.
high-quality Requests high-quality interpolation, potentially at a greater processing cost. Browser support is limited.
crisp-edges Requests scaling that preserves image contrast and sharp edges without introducing smoothing that blurs the image.
pixelated Uses nearest-neighbor scaling, with possible smoothing at the final size, to preserve a pixelated appearance.
initial Resets the property to auto.
inherit Inherits the computed value from the parent element.
unset Inherits the parent's value because the property is inherited.
revert Reverts the property according to cascade origin rules.
revert-layer Reverts the property according to cascade layer rules.

Property Characteristics

Characteristic Value
Initial value auto
Inherited Yes
Applies to All elements
Computed value As specified
Animation type Discrete
Percentages Not applicable
Related properties image-orientation, object-fit, background-size, width, height

The property does not change the dimensions of an image. It changes the preferred rendering method when scaling occurs.

How It Works

When an image is displayed at a size different from its original resolution, the browser must calculate how source pixels map to the displayed pixels. This process is called image interpolation.

Smooth Interpolation

Smooth interpolation blends neighboring pixel colors. It generally produces natural-looking results for photographs and detailed images, although enlarging a small image can make it appear blurry.

.photo {
  width: 400px;
  image-rendering: smooth;
}

Sharp Pixel Scaling

Pixel-oriented scaling preserves distinct blocks of color instead of blending neighboring pixels into smooth transitions.

.pixel-art {
  width: 256px;
  image-rendering: pixelated;
}

Scaling Down

When a large image is reduced, smooth interpolation can combine source pixels to produce a smaller representation. The crisp-edges value requests a result that maintains sharper boundaries.

Scaling Up

When a small image is enlarged, smooth interpolation may blur its edges. The pixelated value is useful when the original pixels should remain recognizable.

Important Consideration

The exact rendering algorithm and visual result can vary between browsers, graphics systems, and scaling ratios. The property expresses a rendering preference rather than specifying every step of the interpolation algorithm.

The auto Value

The auto value allows the browser to choose its normal image scaling algorithm.

Default Rendering

img {
  image-rendering: auto;
}

Photograph Example

.article-photo {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: auto;
}

Browsers commonly use smooth interpolation for photographs, producing gradual transitions between neighboring colors.

Important Consideration

Because auto is the initial value, most images do not require an explicit image-rendering declaration.

The smooth Value

The smooth value requests interpolation that reduces the appearance of individual source pixels when an image is scaled.

Smooth Image Scaling

.smooth-image {
  width: 320px;
  image-rendering: smooth;
}

Responsive Photograph

.responsive-photo {
  max-width: 100%;
  height: auto;
  image-rendering: smooth;
}

Important Consideration

The smooth keyword is part of the CSS Images specification, but browser support is not uniform. Unsupported declarations are ignored, leaving the browser's existing rendering behavior in place.

The high-quality Value

The high-quality value requests high-quality image interpolation, particularly when a browser has multiple scaling algorithms available.

High-Quality Rendering

.detailed-image {
  image-rendering: high-quality;
}

Fallback Declaration

.detailed-image {
  image-rendering: auto;
  image-rendering: high-quality;
}

A browser that does not recognize high-quality ignores the second declaration and retains auto.

Important Consideration

Support for high-quality is limited. It should not be relied upon to guarantee a particular interpolation algorithm or visibly improve every image.

The crisp-edges Value

The crisp-edges value requests image scaling that preserves sharp boundaries and avoids smoothing that would blur the image.

Preserve Sharp Edges

.sharp-image {
  width: 240px;
  image-rendering: crisp-edges;
}

Small Graphic Example

.graphic-icon {
  width: 96px;
  height: 96px;
  image-rendering: crisp-edges;
}

Important Consideration

The exact interpretation of crisp-edges differs across implementations. It is not necessarily identical to pixelated, and some browsers may use different algorithms for the two values.

The pixelated Value

The pixelated value is designed for images whose individual pixels should remain visible when enlarged.

It uses nearest-neighbor scaling to an integer multiple of the source image size, then may apply smoothing if another scaling step is needed to reach the requested display dimensions.

Enlarge Pixel Art

.pixel-art {
  width: 256px;
  image-rendering: pixelated;
}

Enlarge a Small Icon

.pixel-icon {
  width: 128px;
  height: 128px;
  image-rendering: pixelated;
}

Apply to a Game Graphic

.game-sprite {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
}

Important Consideration

For the sharpest results, enlarge pixel art by whole-number scale factors, such as 2, 3, or 4 times its original dimensions. Fractional scaling can produce uneven pixel sizes or some smoothing.

Pixel Art and Icons

Pixel art uses deliberate arrangements of individual pixels to create an image. Smooth interpolation can blur the boundaries between those pixels when the image is enlarged.

Pixel Art Image

<img src="pixel-icon.png" class="pixel-icon" alt="Enlarged pixel art icon">

Pixel Art CSS

.pixel-icon {
  width: 128px;
  height: 128px;
  image-rendering: pixelated;
}

Pixel Art in a Grid

.pixel-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}
.pixel-gallery img {
  width: 100%;
  image-rendering: pixelated;
}

Important Consideration

Not every icon benefits from pixelated scaling. Vector graphics and detailed raster icons usually look better with normal rendering, while deliberately low-resolution artwork often benefits from visible pixel boundaries.

Image Scaling

The image-rendering property affects interpolation when images are displayed at sizes different from their intrinsic dimensions.

Enlarge an Image

.enlarged-image {
  width: 400px;
  image-rendering: pixelated;
}

Reduce an Image

.reduced-image {
  width: 150px;
  image-rendering: smooth;
}

Scale with transform

.scaled-icon {
  transform: scale(3);
  image-rendering: pixelated;
}

Image rendering preferences can also affect the appearance of raster content enlarged through CSS transforms.

Important Consideration

Scaling an image does not add source detail. Enlarging a small photograph with a smooth algorithm may reduce visible pixel boundaries, but it cannot restore information that was not present in the original image.

Background Images

The image-rendering property can also affect the rendering of raster images used as CSS backgrounds.

Pixelated Background

.pixel-background {
  width: 240px;
  height: 160px;
  background-image: url("pixel-pattern.png");
  background-size: 120px 120px;
  background-repeat: repeat;
  image-rendering: pixelated;
}

Smooth Background

.photo-background {
  background-image: url("background.jpg");
  background-size: cover;
  background-position: center;
  image-rendering: auto;
}

Important Consideration

The background-size property controls the dimensions of a background image. The image-rendering property controls the preferred interpolation method used when that image is scaled.

Responsive Images

Responsive images often change display size as the viewport or containing element changes. The appropriate rendering method depends on the image content.

Responsive Photograph

.responsive-photo {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: auto;
}

Responsive Pixel Art

.responsive-pixel-art {
  width: 100%;
  max-width: 256px;
  height: auto;
  image-rendering: pixelated;
}

Adjust Image Size with a Media Query

.pixel-icon {
  width: 128px;
  image-rendering: pixelated;
}
@media (max-width: 600px) {
  .pixel-icon {
    width: 64px;
  }
}

Important Consideration

For photographs, use appropriately sized source images or responsive image techniques such as srcset. The image-rendering property cannot compensate for a source image with insufficient resolution.

image-rendering and object-fit

The object-fit property controls how an image fits inside its content box. The image-rendering property controls how the image pixels are interpolated when scaling is required.

Pixelated Image with contain

.pixel-thumbnail {
  width: 180px;
  height: 180px;
  object-fit: contain;
  image-rendering: pixelated;
}

Photograph with cover

.photo-thumbnail {
  width: 240px;
  height: 160px;
  object-fit: cover;
  image-rendering: auto;
}

Comparison

Property Purpose
image-rendering Controls the preferred pixel interpolation method during scaling.
object-fit Controls how replaced content fits inside its content box.
object-position Controls the position of replaced content within its content box.

Important Consideration

The properties can be combined, but they do not replace one another. Use object-fit for sizing and cropping, and image-rendering for interpolation preferences.

Inheritance

The image-rendering property is inherited. Descendant elements receive the parent's computed value unless another declaration overrides it.

Apply to a Pixel Art Container

.pixel-gallery {
  image-rendering: pixelated;
}

Override a Descendant

.pixel-gallery .photo {
  image-rendering: auto;
}

Explicit Inheritance

img {
  image-rendering: inherit;
}

Reset to the Initial Value

img {
  image-rendering: initial;
}

The initial value is auto.

Reset with unset

img {
  image-rendering: unset;
}

Because the property is inherited, unset behaves like inherit.

image-rendering Example

This example compares normal image rendering with pixelated scaling. A small raster image is enlarged so differences in interpolation are easier to see.

HTML Example

<div class="image-rendering-demo">
  <div class="demo-panel">
    <h3>auto</h3>
    <img src="pixel-icon.png" class="smooth-image" alt="Icon with normal image rendering">
  </div>
  <div class="demo-panel">
    <h3>pixelated</h3>
    <img src="pixel-icon.png" class="pixelated-image" alt="Icon with pixelated image rendering">
  </div>
</div>

CSS Example

.image-rendering-demo {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.image-rendering-demo .demo-panel {
  box-sizing: border-box;
  flex: 1 1 160px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #cccccc;
  border-radius: 4px;
}
.image-rendering-demo h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}
.image-rendering-demo img {
  display: block;
  width: 128px;
  height: 128px;
  max-width: 100%;
}
.image-rendering-demo .smooth-image {
  image-rendering: auto;
}
.image-rendering-demo .pixelated-image {
  image-rendering: pixelated;
}

The browser result below uses a small embedded SVG with a 16-by-16 pixel grid. It is enlarged to 128 pixels so the effect of scaling can be compared without relying on an external image file.

Browser Result

auto

Pixel graphic with normal scaling

pixelated

Pixel graphic with pixelated scaling

The auto image uses the browser's default scaling behavior. The pixelated image requests scaling that preserves distinct source pixels. The exact appearance can vary by browser and image format.

Try crisp-edges

.image-rendering-demo .pixelated-image {
  image-rendering: crisp-edges;
}

This variation requests sharp edge preservation rather than the specific pixelated scaling behavior.

Try smooth

.image-rendering-demo .pixelated-image {
  image-rendering: smooth;
}

Browsers supporting smooth use interpolation that reduces visible pixel boundaries.

Common Mistakes

Expecting image-rendering to Resize an Image

img {
  image-rendering: pixelated;
}

This declaration changes the preferred interpolation method, not the image dimensions. Use width, height, or another sizing method to scale the image.

Using Invalid Keywords

img {
  image-rendering: sharp;
}

The sharp keyword is not a valid standard value.

Assuming crisp-edges and pixelated Are Identical

The two values express different rendering preferences. Their results may differ depending on browser implementation.

Expecting More Detail from a Small Source Image

Image interpolation cannot restore missing detail. Use a higher-resolution source for photographs and detailed graphics.

Using pixelated for Every Image

Pixelated scaling is appropriate for pixel art but generally produces undesirable results for photographs.

Assuming All Keywords Have Equal Browser Support

The smooth, high-quality, and crisp-edges values do not have identical support across browsers.

Ignoring Fractional Scaling

Pixel art displayed at non-integer scale factors may show uneven pixel widths or additional smoothing. Use whole-number enlargement factors when practical.

Important Considerations

Keep the following points in mind when using image-rendering:

  • The property controls preferred image interpolation during scaling.
  • The initial value is auto.
  • The property is inherited.
  • The auto value allows normal browser rendering.
  • The smooth value requests smooth interpolation.
  • The high-quality value requests high-quality interpolation.
  • The crisp-edges value requests preservation of sharp image boundaries.
  • The pixelated value is useful for enlarged pixel art.
  • Browser support varies among the available keywords.
  • The property does not resize an image.
  • Use width, height, or object-fit to control image dimensions and fitting.
  • The property can affect raster images used as CSS backgrounds.
  • Integer scaling factors often produce better results for pixel art.
  • Smooth interpolation cannot restore missing source detail.
  • Photographs generally benefit from normal image rendering.
  • Test scaling results across browsers and display resolutions.

Browser Support

The CSS image-rendering property is widely supported in modern browsers, but support for individual values varies.

The auto and pixelated values are broadly supported. The crisp-edges, smooth, and high-quality values have more limited or inconsistent implementation support.

For current compatibility information, visit Can I Use? and search for image-rendering.

When a browser does not recognize a value, it ignores that declaration and uses the applicable value from the cascade.

Specifications

The image-rendering property is defined in the CSS Images Module Level 3 specification.

CSS Images Module Level 3: image-rendering

The specification describes rendering preferences for scaled images, including smooth interpolation and pixel-oriented scaling.

For additional documentation and examples, consult MDN Web Docs.

MDN Web Docs: image-rendering