Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

There is no single pixel dimension that fits every mobile website background. Size the source image for the element that actually displays it: start with that element’s CSS-pixel width and height, account for how background-size crops or scales the image, then provide enough source pixels for the target device-pixel ratio. Use a separate mobile crop only when it improves the composition or meaningfully reduces what smaller screens download.

How to choose a mobile background image size

“Mobile” does not correspond to one fixed image size. A background is painted into a CSS element whose dimensions depend on your layout. A full-width hero that is 390 CSS pixels wide and 520 CSS pixels tall needs a different composition from a short banner that is 390 by 160 CSS pixels—even on the same phone.

Begin with the rendered box, not a list of phone models. In your browser’s responsive preview or developer tools, inspect the element at the narrow viewport you support and note its rendered width and height in CSS pixels. Then consider the device-pixel ratio (DPR), which describes how many physical display pixels correspond to one CSS pixel. A 390-CSS-pixel-wide box at DPR 2 can use about 780 source pixels across for a 1:1 source-to-device-pixel result. That is a planning target, not a requirement that every image be exactly that width.

For a simple estimate, multiply the rendered CSS dimensions by the target DPR. If a hero displays at 390 × 520 CSS pixels, a 2x source with the same composition would be about 780 × 1,040 pixels. A 3x source would be about 1,170 × 1,560 pixels. Delivering the larger candidate to every visitor may waste bandwidth, so offer density-appropriate alternatives where useful rather than treating the largest estimate as a universal file size.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Measure the element: use its actual mobile width and height, including any layout changes at the viewport you care about.
  • Choose a source ratio: compare the source image’s aspect ratio with the element’s ratio and decide what can safely be cropped.
  • Account for target density: provide enough detail for the screens you support, without forcing the highest-density file on every device.
  • Check the delivered asset: verify which file loads, how it crops, and how large it is at representative viewport sizes.

There is no universal pixel dimension or file-size target: layout, subject placement, image detail, compression, supported browsers, and network conditions all affect the right choice.

#1 Best Overall
Samsung Galaxy A17 5G Smart Phone 128GB US 1 Yr Manufacturer Warranty Black
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.

How background sizing and cropping change the result

cover: fill the box, accept a crop

background-size: cover scales the image until the entire positioning area is covered. If the image and element have different aspect ratios, some of the image may fall outside the box. For example, a wide landscape placed behind a tall portrait hero may lose substantial width. Choose an image with crop-safe composition: keep essential subjects away from edges that might disappear, and test the crop at more than one narrow width.

Set background-position deliberately. center is a reasonable starting point, not a guarantee that the subject remains visible. Try a focal position such as center 35% when the important part of the picture sits above center, then inspect how that choice works across the supported layouts.

contain: preserve the whole image

background-size: contain scales the full image until it fits inside the box, preserving its entire composition. If the ratios differ, unused space can remain along one axis. Use it when showing the complete image matters more than filling every part of the element; set an appropriate background color where gaps may show. Do not choose it for a full-bleed hero unless empty space is acceptable.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a size other than the keywords only with a clear reason

Explicit values such as background-size: 100% auto can be useful when you want the image to match the element’s width while keeping its proportions. But they do not solve every ratio mismatch: depending on the element’s height, the image may not cover the box. Check both axes and the visible result rather than assuming that a width value guarantees a full background.

Rank #2
Samsung Galaxy S26, Unlocked Android Smartphone, 256GB, Black
  • TYPE IT IN. TRANSFORM IT FAST: Enhance any shot in seconds on your smartphone by using Photo Assist¹ with Galaxy AI.² Add objects, restore details, or apply new styles by simply typing or tapping
  • MAKE IT. EDIT IT. SHARE IT: Turn everyday moments into something personal with creative tools built right into your mobile whether it’s a special contact photo, custom wallpaper, an invitation or more³
  • FAST. POWERFUL. AI-READY: Power through your day with AI-accelerated performance from our fastest, smoothest and most powerful Galaxy processor yet, built to keep up with everything you do
  • IMMENSELY IMMERSIVE: No matter where you are or what you’re watching, your favorite videos and more come to life with the vibrant display on Galaxy S26
  • FIT EVERYONE IN THE SHOT: Group selfies are easier on your Samsung phone with a wider front camera⁴ that captures more of the scene, so no one gets left out of the moment

When to serve a different mobile image

There are two distinct responsive-image decisions. Density switching offers the same composition at different resolutions. Art direction uses a different crop or composition for a different layout. Use a media query to switch files when the mobile design needs a portrait crop, a relocated subject, or a simpler image—not merely because the viewport is narrow.

A mobile-specific asset can also reduce transfer size if it avoids downloading an unnecessarily large desktop image. In its 2020 example, web.dev reported a mobile background asset 67% smaller than its desktop counterpart. That is the result of that example, not a general saving guarantee; the result on your site depends on the actual assets and compression.

Switch composition with a media query

.hero {
  background-image: url("/images/hero-mobile.webp");
  background-size: cover;
  background-position: center 35%;
}

@media (min-width: 48rem) {
  .hero {
    background-image: url("/images/hero-wide.webp");
    background-position: center;
  }
}

The 48rem breakpoint is illustrative. Choose the point where the layout or useful crop changes, and test near both sides of that threshold. A breakpoint in a web.dev example falls below 480px, but neither that value nor 48rem defines “mobile” for every site.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Offer resolution alternatives for the same composition

.hero {
  background-image: url("/images/hero-1x.jpg");
  background-image: image-set(
    url("/images/hero-1x.jpg") 1x,
    url("/images/hero-2x.jpg") 2x
  );
  background-size: cover;
  background-position: center;
}

The first declaration is a fallback for browsers that do not use the later syntax. Keep the composition consistent between density candidates so the browser can choose a sharper version without changing the design. Validate the exact image-set() syntax and any format alternatives against current compatibility data for your browser targets; an older compatibility note should not be treated as a statement about current support.

Rank #3
Samsung Galaxy A17 5G Smart Phone 128GB, US 1 Yr Manufacturer Warranty Blue
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.

When a background should instead be an image element

Use a CSS background for presentation: a texture, decorative wash, or visual atmosphere that does not convey information users need to understand the page. A background image does not provide meaningful alternative text to assistive technology. If the picture communicates content—such as a product, person, or chart—use an <img> or <picture> with appropriate alternative text instead.

For content images, srcset lists image candidates and sizes describes the expected display slot when using width descriptors. The browser can use those hints to select a suitable candidate. A <picture> element can add media-based art direction or format alternatives while retaining an <img> fallback. This is usually a better fit than using a background when the image is part of the content rather than decoration.

How to check the image on real layouts

  1. Measure the element: inspect the background’s CSS-pixel width and height at representative narrow and wider viewports. Include cases where text wraps or the hero height changes.
  2. Check the crop: test the chosen cover or contain behavior, and adjust background-position if the focal subject is clipped or misplaced.
  3. Inspect asset selection: confirm that the intended mobile file or density candidate is requested at each viewport and DPR you support. Do not assume a media query or image-set() selected the intended resource without checking.
  4. Review visual quality and bytes: look for softness, visible compression artifacts, and assets larger than the layout needs. Compare candidates at their rendered size, not only in an image editor at 100% zoom.
  5. Test target browsers and assistive meaning: check the actual browser set for the CSS syntax you use. If the image conveys content, provide it as a semantic image with suitable alternative text rather than relying on a background.

Browser responsive previews help you inspect layout, but verify on representative devices or browsers too when their rendering is important to the release. The useful test cases are the viewport sizes where your layout changes, screens with higher DPR, and any crop that places a face, product, or other focal subject near an edge.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Performance and loading considerations

Responsive files can avoid downloading a desktop-scale asset on a small layout, but the benefit depends on the images you actually serve. Compare transferred bytes for the selected candidate, not just the pixel dimensions written in a filename. More pixels can improve sharpness on a dense display, yet excessive source dimensions can mean unnecessary download and decode work.

Rank #4
Motorola Moto G Play LTE | Unlocked | Made for US 4/64GB | 50MP Camera | Sapphire Blue
  • Blazing-fast Qualcomm performance. Get the speed you need for great entertainment with a Snapdragon 680 processor and 4GB**** of RAM.
  • Fluid display + immersive stereo sound. Bring your entertainment to life with an ultrawide 6.5" 90Hz* HD+ display plus stereo speakers, Dolby Atmos, and Hi-Res Audio**.
  • 50MP*** Quad Pixel camera. Capture sharper, more vibrant photos day or night with 4x the light sensitivity.
  • 64GB**** built-in storage. Get plenty of room for photos, movies, songs, and apps—and add up to 1TB more with a microSD card*****.
  • Unbelievable battery life. Work and play nonstop with a long-lasting 5000mAh battery.*****

A hero background may be the page’s largest contentful paint (LCP) image. CSS backgrounds are not discovered by the browser’s preload scanner in the same way as an image in HTML, so discovery can be later. If a background is a likely LCP candidate, consider whether it can be an <img>; if it must remain a background, assess whether a responsive preload is appropriate so the right viewport candidate is fetched. Avoid excessive preloads, which can compete with other important resources.

Keep density switching and art direction separate in your decisions: use image-set() when the composition stays the same and resolution changes, and a media query when the image itself should change. That distinction makes it easier to check both the visual crop and the downloaded resource.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common background-image problems

  • The image looks blurry on a high-density phone: check the element’s CSS size and the device’s DPR, then ensure a sufficiently detailed candidate is available and selected. Do not fix softness by serving the largest file to every visitor without checking the cost.
  • The subject disappears on mobile: cover is cropping the image, or the focal point is poorly positioned. Adjust background-position, choose a crop-safe asset, or supply a mobile-specific composition.
  • Part of the box is empty: the image may not cover the element, or contain may be preserving the full image with leftover space. Decide whether the complete image or a filled box matters more, then use the matching sizing behavior and background color.
  • The mobile asset is not loading: inspect the active media query, its breakpoint, and the requested URL in browser developer tools. Check for a typo or missing file, and test just below and above the breakpoint.
  • The newer candidate syntax seems ignored: retain a fallback declaration and validate the precise image-set() form against the browsers you support. Check the network request as well as the visual result.
  • The hero appears late: determine whether it is an LCP candidate. A CSS background may be discovered later than an HTML image; consider an image element or an appropriate responsive preload, and avoid preloading candidates that the layout will not use.
  • A decorative image is being announced as content—or useful information is missing: CSS backgrounds have no alternative text. Keep purely decorative art as a background; move meaningful imagery into semantic HTML with suitable alternative text.

Or skip the browser setup

You can capture a page at a chosen URL and then inspect its mobile rendering without setting up browser automation. For example, this cURL request saves a WebP screenshot of a page; replace https://stripe.com with the URL you want to inspect. See the ScreenshotNeo API documentation for request options and response details.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo is a website screenshot API and MCP server. A screenshot can help you review a crop, but it does not determine the correct source dimensions for your layout: measure the element and check the image candidate yourself. Before capture, ScreenshotNeo accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.

Best Value
Samsung Galaxy A17 5G Smart Phone 128GB, US 1 Yr Manufacturer Warranty Gray
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.

Frequently Asked Questions

Should I use the phone’s full screen resolution as my background image dimensions?

No. Size the image for the CSS element that displays it and its crop behavior; the phone’s screen resolution alone does not describe that box.

Can a CSS background have alt text?

No. If the image conveys information, use a semantic image element with appropriate alternative text.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Is 48rem the right breakpoint for mobile backgrounds?

No. It is an example value; set the breakpoint where your layout or image composition actually changes.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.