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

A website hero image is the prominent visual that introduces a page, product or campaign. The right implementation is not one universal pixel size: choose the source dimensions, crop, format, loading behavior and alternative text from the image’s rendered role at each breakpoint. A hero can become the page’s Largest Contentful Paint (LCP) element, but a large heading or other text block can be the LCP instead.

What is a website hero image?

A hero image is the large, high-visibility visual near the top of a page. It may sit beside a headline, fill a banner, appear behind content, or introduce a product, article or campaign. Its job is contextual: it should help visitors understand the page’s message, not merely occupy the largest available rectangle.

Because layouts, audiences and screens differ, there is no single correct “hero image size.” A 1,600-pixel-wide photograph might be appropriate for a full-bleed desktop banner but wasteful for a 480-pixel mobile column. Conversely, a small source enlarged on a retina display can look soft. Start with the displayed dimensions, focal point and expected connection speeds, then create responsive candidates.

How large should a website hero image be?

Size for the rendered slot, not the device’s maximum width

Measure the image box at the widest layout and at common breakpoints. If a desktop hero is 1,200 CSS pixels wide, provide a candidate around that width and a denser version for high-resolution screens; do not automatically send a 3,000-pixel original to every visitor. A two-column hero may render at only half the viewport width, so its appropriate file can be much narrower than a full-bleed banner.

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 several width candidates and let the browser choose. The following pattern uses width descriptors, so the sizes attribute tells the browser how wide the image will be in the layout:

<img
  src="/images/hero-1280.webp"
  srcset="
    /images/hero-480.webp 480w,
    /images/hero-768.webp 768w,
    /images/hero-1280.webp 1280w,
    /images/hero-1920.webp 1920w"
  sizes="(max-width: 700px) 100vw, (max-width: 1100px) 50vw, 1200px"
  width="1200"
  height="675"
  alt="A cyclist riding along a coastal road at sunrise"
>

Those numerical candidates are examples, not a rule. Generate versions that match your actual slot and image quality requirements. With width descriptors, always provide an accurate sizes value; otherwise the browser may select a needlessly large resource.

Reserve the aspect ratio with width and height

Include intrinsic width and height attributes even when CSS makes the image fluid. The browser can reserve the correct aspect ratio before bytes arrive, reducing layout movement as the hero loads. Set display:block; width:100%; height:auto; or an equivalent responsive rule in CSS.

#1 Best Overall
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Choose quality and format together

Compare the rendered result, not just file size. WebP or another supported modern format can reduce transfer bytes, while JPEG remains useful for broad compatibility and photographic content. PNG is generally suited to graphics requiring lossless detail or transparency. Use a format your browser-support policy permits, and inspect text, faces and fine edges at the actual display size.

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

How do I make a hero image responsive?

Use responsive candidates for normal images

The srcset/sizes pattern above is the default for an <img> hero. The browser selects a candidate based on the slot width, device pixel ratio and network conditions. Keep the source crop compatible across breakpoints when possible.

Use a picture element when the crop or art direction changes

If mobile needs a different composition—for example, a portrait crop that keeps a person visible—serve an alternate file with <picture>:

<picture>
  <source media="(max-width: 700px)" srcset="/images/hero-mobile.webp">
  <source type="image/webp" srcset="/images/hero-1280.webp">
  <img src="/images/hero-1280.jpg"
       width="1280" height="720"
       alt="A chef preparing a meal in an open kitchen"
       fetchpriority="high">
</picture>

Review real desktop, tablet and mobile screenshots. CSS cropping can also preserve a focal point:

.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 65% center;
}

Adjust object-position (or a background image’s position) when the subject is cut off. Do not assume the center is always the correct focal point.

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

Background images need extra care

A CSS background is not discoverable in the initial HTML in the same way as an image element. It can therefore be harder to prioritize and to provide an accessible text alternative. If the visual conveys information, prefer an <img> with meaningful alt text. If it is purely decorative, a background can be appropriate, but keep all essential wording in real HTML text.

Should a hero image be lazy loaded?

Do not apply loading="lazy" to an above-the-fold hero. Delaying a visible image can postpone the page’s main visual. For a genuinely important LCP image, consider fetchpriority="high":

<img src="/images/hero.webp"
     width="1280" height="720"
     fetchpriority="high"
     alt="A map showing the trailhead and route"> 

High priority is a scarce signal. Use it only for a resource that is truly vital; applying it to many images can compete with stylesheets, fonts or other critical assets. See web.dev’s responsive-images guidance and Google Chrome’s modern performance guidance.

When is preload useful?

When the hero is present in the initial HTML, the browser can usually discover it without a preload. Preload selectively when the image is otherwise hidden from early discovery, such as a CSS background or JavaScript-inserted asset:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<link rel="preload" as="image" href="/images/hero.webp" type="image/webp">

Remove the preload if it does not improve real-user results; unnecessary preloads consume early bandwidth.

How hero images affect LCP and layout stability

Largest Contentful Paint measures when the largest visible image or text block finishes rendering relative to page load. The hero is often the candidate, but it is not guaranteed to be. Google’s recommended “good” LCP threshold is 2.5 seconds or less at the 75th percentile, segmented for mobile and desktop. Treat this as a page-level target, not a promise that changing only the hero will achieve it. Measure with field data and laboratory tools, then check server response time, CSS, fonts, image discovery, decoding and other resources.

For stability, reserve space with width and height, keep the aspect ratio consistent, and avoid injecting a different-height hero after load. If text overlays the image, ensure the text remains readable while the image is downloading and after it is replaced by the final crop.

How should a hero image be cropped?

Keep the focal subject inside every safe area

Mark the subject and any important logos before exporting. Test the crop at narrow mobile, tablet and wide desktop widths. A face, product or landmark near an edge may disappear when object-fit: cover fills a taller mobile box. Use an art-directed mobile source when moving the focal point is more effective than shrinking the entire image.

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

Account for overlays and text

Leave contrast behind the headline and call to action. A dark gradient or a deliberately quiet side of the photograph can improve legibility, but do not bake essential text into the bitmap. Responsive text should remain selectable, translatable and available to assistive technology.

What should I put in the alt text?

W3C states: “Images must have text alternatives that describe the information or function represented by them.” Write the alternative according to purpose:

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
  • Informative: describe the essential subject in the page’s context, such as alt="Solar panels installed on a school roof".
  • Decorative: use a null alternative, alt="", when the image adds no information and nearby text already carries the message.
  • Functional: describe the action or destination when the image is a link or button, such as alt="View the winter collection".

Do not begin with “image of,” repeat a caption word-for-word without purpose, or stuff keywords. Google Search Central recommends descriptive filenames and useful, contextual alt text; it combines alt text with page context and computer vision. Use a filename such as coastal-cyclist-sunrise.webp, not an arbitrary camera ID. Read the W3C Images Tutorial and Google’s image SEO guidance for further examples.

Hero-image implementation checklist

  • Define whether the visual is informative, decorative or functional.
  • Measure the rendered slot at mobile and desktop breakpoints.
  • Export responsive width candidates and provide an accurate sizes attribute.
  • Use width and height to reserve the aspect ratio.
  • Choose a practical format and quality after inspecting the rendered result.
  • Keep important subjects inside safe crop areas; use art direction when needed.
  • Do not lazy-load an above-the-fold hero.
  • Consider fetchpriority="high" only for a genuinely vital LCP candidate.
  • Preload only when early discovery is otherwise difficult.
  • Keep essential text in HTML and ensure sufficient contrast.
  • Write concise, contextual alt text or use alt="" for decoration.
  • Test actual mobile and desktop performance, including LCP and layout shifts.

Or skip the browser setup

If you need a screenshot of a live page as a hero reference, regression artifact or content asset, ScreenshotNeo provides a website screenshot API and MCP server. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP tools—take_screenshot, get_page_info and capture_pdf—work with Claude, Cursor and other MCP clients.

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

One GET request returns PNG, JPEG, WebP or PDF. See the ScreenshotNeo documentation for all options, including full-page and element capture, device and retina settings, custom CSS or JavaScript, waiting rules, request blocking, headers, cookies, geolocation, transparent backgrounds, resizing, caching, signed links, asynchronous webhooks, bulk capture and usage reporting.

cURL

curl -G "https://api.screenshotneo.com/v1/shot" 
  -d access_key=YOUR_API_KEY 
  --data-urlencode url=https://stripe.com 
  -o shot.webp

Python

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({
  access_key: 'YOUR_API_KEY',
  url: 'https://stripe.com'
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const buffer = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', buffer));

The Free plan includes 1,000 screenshots per month with no card. Paid plans are Starter $5 for 3,000, Growth $15 for 15,000, Pro $39 for 60,000, Scale $99 for 250,000 and Business $249 for 1,000,000; yearly billing gives two months free, and every feature is included on every plan. Create a free ScreenshotNeo account to start.

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

Troubleshooting hero-image problems

The hero is blurry

Check the candidate selected in browser developer tools, the rendered CSS width and the device pixel ratio. Add a sufficiently large candidate, correct the sizes declaration and inspect compression quality. Do not solve a crop problem by sending the largest original to everyone.

The subject is cut off on mobile

Use object-position or provide a mobile-specific <source> in <picture>. Recheck the crop with the headline and button visible.

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

The page jumps while loading

Add accurate intrinsic dimensions, preserve the aspect ratio in CSS and avoid replacing the image with an element of a different height after load.

The hero appears late

Remove lazy loading from the above-the-fold image, verify it is discoverable in initial HTML, and consider fetchpriority="high" only if it is the important LCP candidate. Investigate server, CSS and font delays as well as image bytes.

Alt text feels repetitive

Describe only information not already available in adjacent text. If the visual is decorative, use alt=""; if it is a control, describe its action rather than its appearance.

A screenshot API returns an unexpected page

Check the returned HTTP status and ScreenshotNeo’s X-Page-Verdict and X-Billed headers. A consent dialog, bot check, blank page, timeout or failed load should be identified by the verdict; adjust waiting, headers, cookies or blocking options in the documentation rather than treating a failed capture as a valid hero asset.

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

FAQ

Frequently Asked Questions

Does every hero need to be a photograph?

No. A diagram, illustration, product render or even a text-led layout can be the most appropriate hero. Choose the visual that communicates the page’s purpose and meets contrast and accessibility needs.

Should the hero always be full width?

No. A contained or two-column hero may better match the content hierarchy and can reduce transfer work because the rendered slot is narrower.

Can I put the headline inside the image?

Avoid it. Keep essential text as HTML so it remains accessible, responsive, searchable and translatable; use the image for supporting visual information.

Quick Recap

SaleBestseller No. 1
HTML and CSS: Design and Build Websites
HTML and CSS: Design and Build Websites
HTML CSS Design and Build Web Sites; Comes with secure packaging; It can be a gift option
$14.94
SaleBestseller No. 3
SaleBestseller No. 4
Web Design with HTML, CSS, JavaScript and jQuery Set
Web Design with HTML, CSS, JavaScript and jQuery Set
Brand: Wiley; Set of 2 Volumes
$35.05

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.

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