Optimize images for the web: from Figma to production

How to optimize images for the web from Figma: export at the right size, pick a format, set quality, serve 1x and 2x, and load the hero image first.

By UIXport team12 min read
On this page

Key takeaways

  • Export each image at the width it is shown, times the screen density you support. For most web images that means a 1x and a 2x file.
  • Choose the format by content. SVG for vector art, WebP or AVIF for photos, PNG or lossless WebP for screenshots and anything that needs exact pixels.
  • Use lossy compression for photos and lossless for flat UI and text, and pick the quality by looking at the result, because quality numbers don't carry over between formats.
  • Let the browser choose with srcset and picture, and give every img a width and height.
  • Never lazy-load the hero image. Give it fetchpriority="high" and lazy-load what sits below the fold.
  • In UIXport, one run can export JPG, WebP and AVIF (Pro) at several scales with a quality from 5 to 100. PNG is Figma's own PNG and is not compressed further.

Short answer: To optimize images for the web, export each one at the size it is shown times the screen density (usually 1x and 2x), choose the format by content (SVG for vector art, WebP or AVIF for photos, PNG when you need exact pixels), and set lossy quality by eye. Then let the browser pick the right file with srcset or <picture>, load the hero image first and lazy-load everything below the fold.

This guide follows one image from a Figma frame to a live page in five steps, with links to narrower posts when you want more detail.

Why are images usually the heaviest part of a page?#

Because nearly every page has them, and on the median homepage they outweigh every other resource type except video. In the HTTP Archive's 2024 Web Almanac, 99.9% of pages requested at least one image (Media chapter). The median mobile homepage loaded 900 KB of images against 558 KB of JavaScript. Leaving video aside, images are the largest resource type (Page Weight chapter).

Images are also often what people are waiting to see. On 68% of mobile pages, the element behind Largest Contentful Paint had an image (Media chapter). Largest Contentful Paint (LCP) is a Core Web Vitals metric for when the biggest piece of content in the viewport finishes rendering. web.dev's target is 2.5 seconds or less for at least 75% of page visits (web.dev).

So the hero photo on your landing page often decides the page's LCP score. Much of its extra weight is decided at export, which is also where it is cheapest to fix.

Step 1: What size should website images be?#

Export each image at the width of the slot it fills on screen, in CSS pixels, times the device pixel ratio you want to look sharp on. A photo in a 400 px wide card needs a 400 px file for standard screens and an 800 px file for 2x screens.

Device pixel ratio (DPR) is the number of physical screen pixels behind each CSS pixel. A standard display has a DPR of 1. On a high-density display it is higher, for example 2. web.dev uses the same example: a 400 px slot needs an image at least 800 px wide to stay sharp at DPR 2 (web.dev Learn Images).

Going bigger buys nothing. The browser downloads the extra pixels, then throws them away when it scales the image down. The Web Almanac found the largest image on the median mobile page was about 0.54 megapixels (735×735 if square), and that pages sending more than that were very likely sending pixels the crawler's screen couldn't show (Media chapter).

In Figma, this maps neatly if you design at 1x. Export scale is a multiplier, and the export field also takes a fixed width such as 1200w or a fixed height such as 600h (Figma help). A card image that is 400 px wide in a 1440 px desktop frame gives you 400 px at 1x and 800 px at 2x.

Say you are handing a landing page to a developer and the hero sits in a 1200 px container. Export it at 1200 px and 2400 px. On a phone the same image might be 375 px wide, so smaller versions help too. Step 4 covers how the browser chooses.

What about 3x? It gives you nine times the pixels of the 1x file. For most web images, 1x and 2x are a sensible default. Save 3x for app assets and the rare web image that needs it. The full breakdown is in how Figma's 1x, 2x and 3x exports work.

Step 2: Which image format should you use?#

Pick the format by what is in the image. Vector art goes out as SVG, photos as WebP or AVIF with a JPEG fallback, and screenshots or anything that needs exact pixels as PNG or lossless WebP. What each format can and can't do, asset by asset, is in the best image format for every website asset.

What is in the image First choice Fallback Why
Logo, icon, simple illustration SVG PNG Vector art stays sharp at any size and is usually tiny
Photo, hero image, rich illustration WebP or AVIF (lossy) JPEG Lossy compression hides well in continuous-tone images
Screenshot, UI mockup, diagram with text PNG or lossless WebP PNG Lossy artifacts show around text and hard edges
Anything with transparency WebP, AVIF or PNG PNG JPEG has no alpha channel

Sources: web.dev on choosing a format and MDN's image format guide.

Both say WebP and AVIF generally compress better than the older formats, and both recommend a JPEG or PNG fallback. Real pages point the same way. In the Web Almanac, the median WebP used 1.3 bits per pixel (the data each pixel costs), AVIF 1.4, JPEG 2.0 and PNG 3.8 (Media chapter). Those are medians across very different images, not a controlled test, so read them as a direction.

One more rule from web.dev: keep text out of images, because it can't be selected, searched or zoomed. If the banner headline is live text in the design, hand it over as live text.

Figma's built-in export covers PNG, JPG, SVG and PDF (Figma help). For WebP and AVIF you need a plugin. UIXport adds WebP export on the Free plan and AVIF export on Pro, and its SVG rows can run SVGO to strip Figma's extra markup. For UI work specifically, see AVIF vs WebP vs PNG for UI design.

Step 3: Should you use lossy or lossless compression?#

Use lossy for photos and lossless for flat UI, screenshots and text. Set lossy quality by looking at the result, not by a number.

Lossless compression makes a file smaller without changing a single pixel. Lossy compression throws away detail you are unlikely to notice, and the quality setting controls how much (MDN).

Lossless Lossy
What it does Reproduces every pixel exactly Discards some data for a smaller file
Formats PNG, lossless WebP, lossless AVIF JPEG, lossy WebP, lossy AVIF
Best for Screenshots, diagrams, logos, line art Photos and continuous-tone images
What to watch Big files when used for photos Blur and colored fringes on text and sharp edges

Why quality 80 isn't one thing#

Quality numbers don't travel between formats. web.dev notes that quality levels for different formats are not directly comparable, because the encoders work differently (web.dev). JPEG at 80, WebP at 80 and AVIF at 80 are three different results.

So don't copy someone else's number. Export two or three levels, open each zoomed in, and look at the hard parts: skin, soft gradients, small text, thin lines. Lower the quality until you see damage, then go back up a notch.

Where you set it#

  • Figma's own export has a quality setting for JPG and PDF, and JPG defaults to High (Figma help). PNG is lossless.
  • UIXport has a Quality Level slider from 5 to 100, default 90, with presets Best (95%), High (80%), Medium (60%) and Low (40%). It applies to JPG, WebP, AVIF and PDF rows. Each item also has its own quality dropdown. Picking a value there also moves the main Quality Level, so after you set the slider, give each item its own value: the hero higher, the thumbnails lower. Moving the slider again clears all per-item choices. On Pro, a row's Max file size (KB) picks the highest quality that fits the size you set.

Step 4: How to serve 1x, 2x and modern formats#

Give the browser a list and let it choose. srcset offers the same image at several sizes or densities, and <picture> with <source type> offers several formats with a plain <img> as the fallback. Your job is to export the files the markup names.

There are two kinds of srcset:

  • Density descriptors (1x, 2x) fit images shown at one fixed CSS size, such as a logo, an avatar or a card thumbnail. The browser picks by screen density (MDN).
  • Width descriptors (600w, 1200w) plus a sizes attribute fit images whose width changes with the layout, such as a full-width hero. web.dev says it is common to serve three to five sizes (web.dev).

A fixed-size image in three formats looks like this:

html
<picture>
  <source type="image/avif" srcset="card.avif 1x, [email protected] 2x" />
  <source type="image/webp" srcset="card.webp 1x, [email protected] 2x" />
  <img src="card.jpg" srcset="card.jpg 1x, [email protected] 2x"
       width="400" height="300" alt="Two people reviewing a dashboard" />
</picture>

And a hero that changes width:

html
<img src="hero-1200.webp"
     srcset="hero-600.webp 600w, hero-1200.webp 1200w, hero-1800.webp 1800w, hero-2400.webp 2400w"
     sizes="(min-width: 1280px) 1200px, 100vw"
     width="1200" height="675" alt="Product dashboard on a laptop" />

That sizes value is where design knowledge matters. The Web Almanac found the median sizes attribute was 16% too large on mobile and 43% on desktop, which can make the browser fetch a bigger file than needed (Media chapter). You know the real layout widths, so put them in the handoff.

The width set comes from one layer. A hero 1200 px wide in the frame exports at 600, 1200, 1800 and 2400 px with the 0.5x, 1x, 1.5x and 2x scales, and a Filename suffix such as -600 on each row names the files.

The steps in UIXport#

  1. Select the image. Select the layer or frame in Figma and open UIXport on the Exporter tab.
  2. Add a row per file. In Export as, set the first row to WEBP at 1x. Click Add format for each extra file and change the new row, which starts as PNG at 1x. For example, add WEBP at 2x, then JPG at 1x and 2x for the fallback. With Pro, add AVIF rows as well.
  3. Name the 2x files. Open each 2x row's menu, type @2x in Filename suffix and click Done. The suffix goes after the naming pattern, so a frame named card exports as [email protected].
  4. Set the quality. Use the Quality Level slider or a preset such as High (80%).
  5. Export. Click Export Selected (N Formats). Two or more files arrive together in one ZIP.
  6. Copy the markup. In Dev tools, choose Picture Tag. Under Included formats, turn off AVIF (unless you exported it on Pro) and PNG, which are on by default, and keep WEBP. Leave 1x and 2x on under Resolutions, pick JPG as the Fallback src format, then click Copy HTML.

On the Free plan, these rows have no export limit, and Picture Tag writes markup only. The encoding happens inside Figma, so the design is not uploaded anywhere.

Picture Tag writes density descriptors, for the first selected item only. For width descriptors and sizes, write the markup by hand or generate it in your build.

Step 5: Which images should load first?#

The image most likely to be the LCP element, usually the hero, should load as early as possible: no lazy loading, and fetchpriority="high". Images below the fold get loading="lazy". Every image gets a width and height.

Image loading fetchpriority width and height
Hero or other likely LCP image Leave it out (eager) high Yes
Other images in the first screen Leave it out Default Yes
Images below the fold lazy Default Yes

web.dev is blunt: "Never lazy-load your LCP image" (web.dev). It suggests fetchpriority="high" on the likely LCP image, and a high-priority preload when the hero is a CSS background.

It is a common mistake. In the Web Almanac's 2024 crawl, lazy loading ran on a third of websites, and 9.5% of LCP images on mobile were lazy-loaded (Media chapter).

As of October 2026, loading="lazy" works on images in Chrome 77, Edge 79, Firefox 75 and Safari 15.4 and later (iframe support followed in Firefox 121 and Safari 16.4) (web.dev, caniuse). web.dev also recommends width and height on every <img>, so the browser reserves space and the layout doesn't jump.

You know which image is the hero at each breakpoint, so write it in the handoff notes.

How do you measure the result?#

Check file sizes at export, look at the files zoomed in, then test the page. Lighthouse flags images that could be smaller, and field LCP tells you whether the hero arrives in time.

  • At export. For images you upload with Upload local file, UIXport shows Original, Exported and Saved sizes after the run. Frames from the canvas have no original byte size, so export a JPG row and a WEBP row and compare the files in the ZIP.
  • By eye. Open the files at 100% and 200%. A smaller file that looks wrong is not an optimization.
  • In Lighthouse. Lighthouse's image-encoding check recompresses JPEGs at quality 85 and flags images that would save 4 KiB or more. As of Lighthouse 13 it lives inside the "Improve image delivery" insight (Chrome for Developers).
  • In the field. Aim for LCP of 2.5 seconds or less for at least 75% of visits (web.dev).

We don't publish size-saving figures for UIXport's WebP or AVIF output. Results depend on the image and the quality you choose, so measure on your own designs.

A Figma-to-production checklist#

Run through this before you hand a page over.

  • Size. Each image is exported at its display width at 1x and 2x, and nothing is larger than its biggest slot at 2x.
  • Format. SVG for vector art, WebP or AVIF for photos with a JPEG fallback, PNG or WebP for screenshots and transparency.
  • Text. Headlines and buttons stay live text, not pixels inside an image.
  • Quality. Chosen by eye, zoomed in, with the hero set higher if it needs it.
  • PNG. Run through an optimizer, or swapped for WebP.
  • Names. name.ext and [email protected], using only letters, numbers, hyphens and underscores, matching the markup.
  • Markup. <picture> or srcset, real sizes values from your layout, width and height on every <img>, and real alt text.
  • Loading. Hero without loading="lazy" and with fetchpriority="high". Everything below the fold lazy-loaded.
  • Check. A Lighthouse run and a zoomed look at the final files.

If your next handoff is a landing page, try the steps above on its hero image first. Install UIXport from Figma Community to export WebP, JPG and PNG at several scales in one run, with AVIF on Pro.

Questions

What size should website images be?

As wide as the space they fill on screen in CSS pixels, times the device pixel ratio. An image in a 400 px slot needs a 400 px file for standard screens and an 800 px file for 2x screens.

Is lossy or lossless compression better for web images?

Lossy suits photos and other continuous-tone images, where the lost detail is hard to see. Lossless suits screenshots, diagrams, logos and text, where lossy artifacts show around sharp edges.

What quality should I use for WebP or JPEG?

There is no single right number, and the same number means different things in different formats. Export two or three quality levels, compare them zoomed in, and keep the lowest one that still looks right.

Should I lazy-load every image?

No. Lazy-load images below the fold, but never the image most likely to be the Largest Contentful Paint element, which is usually the hero. web.dev says lazy-loading the LCP image always delays it.

Can Figma export WebP or AVIF?

Not on its own. Figma's built-in export covers PNG, JPG, SVG and PDF. A plugin such as UIXport adds WebP on the Free plan and AVIF on Pro.

Does UIXport compress PNG files?

No. UIXport's PNG is Figma's own PNG at the scale you choose, and the quality slider does not apply to it. Use a PNG optimizer afterwards, or export WebP instead.

Features in this post

Share this post

Share on XShare on LinkedIn

UIXport team

We build UIXport, the Figma plugin for exporting, compressing and delivering UI assets, at Sigma Studio.

About UIXport

Try it in Figma

Install the plugin from Figma Community. Free includes unlimited core exports and 10 Pro runs a month; Pro adds motion export, print-ready PDFs, AVIF and more.