Sub topic 13
Digital ad sizes, formats and file-weight limits
This chapter assumes you can already export images from a design tool, you know the difference between vector and raster graphics, and you have read the placement specification sheet for your campaign. It covers how to turn a digital spec sheet into files that an ad platform will accept.
Why digital specs behave differently from print
A print ad is defined by physical size, bleed and colour mode. A digital ad is defined by pixel dimensions, file format and file weight. File weight is the size of the file in kilobytes (KB) or megabytes (MB).
Digital specs also change often. Each network, such as Google Display Network, Meta or a publisher's own ad server, publishes its own limits. Always read the current sheet for the placement you are buying. Do not rely on numbers from memory or from this chapter.
Three questions drive the work:
- What are the exact pixel dimensions, or aspect ratio, of each placement?
- Which file formats does the platform accept?
- What is the maximum file weight, and how long may animation run?
Pixel dimensions and common sizes
Digital ads are measured in CSS pixels (the layout units a browser uses), not inches. A 300x250 ad occupies 300 by 250 CSS pixels. On a high-density screen, one CSS pixel is drawn with several device pixels, so a flat 300x250 image looks soft there.
These are standard display banner sizes you will meet often:
| Name | Size (px) | Typical position |
|---|---|---|
| Medium rectangle | 300x250 | Inside article content |
| Leaderboard | 728x90 | Top of a desktop page |
| Large mobile banner | 320x100 | Mobile page top or bottom |
| Half page | 300x600 | Sidebar |
| Billboard | 970x250 | Top of a desktop page |
Social placements often specify an aspect ratio, which is width divided by height, instead of fixed pixels. A 1:1 square, a 4:5 portrait and a 9:16 vertical story are common examples. For these, the spec usually gives a minimum width and a safe zone where interface elements such as profile names or buttons cover the image.
Exporting for high-density screens
To keep an ad sharp, supply the image at twice the display size and let the browser scale it down. The HTML below declares the ad size and offers a 1x and a 2x image.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="ad.size" content="width=300,height=250">
<title>Spring Sale 300x250</title>
</head>
<body style="margin:0">
<a href="https://example.com" style="display:block;width:300px;height:250px">
<img src="banner.png" srcset="banner.png 1x, [email protected] 2x" width="300" height="250" alt="Spring Sale: 20% off">
</a>
</body>
</html>The ad.size meta tag is the one Google Ads uses for HTML5 uploads. The width and height attributes on the image fix its display size, so the 2x file (600x500 pixels) is shown at 300x250. The alt text describes the ad for screen readers.
A 2x file is larger than a 1x file, so check it against the weight limit. If it is too heavy, reduce the detail in the image before you reduce its dimensions.
The pixel arithmetic is the same idea you used for print, with pixels per inch removed. The script below computes the pixel size of an export at a scale factor.
// Pixel size of an export for a banner at a given scale factor.
const exportSize = (cssWidth, cssHeight, scale) => ({
width: Math.round(cssWidth * scale),
height: Math.round(cssHeight * scale),
});
console.log(exportSize(300, 250, 1)); // { width: 300, height: 250 }
console.log(exportSize(300, 250, 2)); // { width: 600, height: 500 }File formats
Each format suits a different kind of content.
| Format | Best for | Notes |
|---|---|---|
| JPG | Photographs | Lossy compression. No transparency. Small files at moderate quality. |
| PNG | Flat graphics, logos, text, transparency | Lossless. Photos make large files. |
| GIF | Simple animation | Limited to 256 colours per frame. Often large for its quality. |
| WebP | Photos and graphics | Smaller than JPG or PNG, but not accepted by every platform. |
| SVG | Logos and icons | Vector, scales without blur. Often restricted inside ads. |
| HTML5 (zipped) | Interactive or animated ads | Bundle of HTML, CSS, JavaScript and images. |
| MP4 | Video | Codec, frame rate and length are specified by the platform. |
Lossy compression discards some image data to reduce size. Lossless compression keeps every pixel. Use JPG for photos and PNG for text and sharp edges. A photo saved as PNG is often several times heavier than the same photo as JPG, and text saved as JPG shows blurry fringes around letters.
Platforms usually accept only some of these formats for a given placement. Check the sheet before you pick.
File-weight limits
Many display networks cap static banners at around 150 KB and set separate rules for HTML5 bundles, but values differ by platform and change over time. Read the sheet.
Limits exist because ads load on top of the page the reader came for. Heavy ads slow the page, use mobile data and are often blocked or rejected.
Weight also depends on the type of load. Some publishers distinguish the initial load, which happens with the page, from the polite load, which happens after the page finishes. A rich ad may be allowed a small initial file and a larger polite file.
Ways to reduce weight
- Export photographs as JPG and lower the quality in small steps until artefacts become visible, then go back one step.
- Reduce the number of colours in PNG or GIF files when the artwork is flat.
- Remove metadata, such as embedded colour profiles you do not need and camera data, using your export dialog or an optimiser.
- Crop the image to what is visible. Hidden areas still count.
- Use one font weight, or convert headline text to an image, rather than loading several web fonts.
- Shorten animations and cut frames that carry no new information.
- Reuse assets. An HTML5 ad that loads a logo once is lighter than one that includes it three times.
Keep the colour mode in mind. Digital files use RGB, specifically sRGB for most ad networks. A CMYK JPG may display with wrong colours in browsers.
Animation rules
Many platforms limit animation. Typical rules cover maximum duration, number of loops and frame rate. A common pattern is a total length of 15 to 30 seconds with up to three loops, but this is a pattern, not a rule. Check each sheet.
Design the animation so the last frame works alone. The last frame holds the message and call to action, and it is what many readers see when the animation stops. Some placements also show the first frame as a static preview. In that case, make sure the first frame is not blank.
Avoid rapid flashing. It can trigger seizures and is prohibited by many platforms.
A workflow for turning a spec sheet into files
The diagram shows a repeatable sequence.
Follow these steps:
- Build a checklist table from the spec sheet. Include one row per size, with format, maximum weight, animation limits and safe zones.
- Design a master layout, then adapt it to each size. The adaptation method is covered in a later chapter.
- Export every size with a clear filename, such as
spring-sale_300x250_v1.jpg. - Check each file's weight in your file manager. Do not trust the estimate in the export dialog.
- Preview in the platform's upload tool, which shows rejections, cropping and interface overlays.
Contrast and legibility on screen
Banners are small, and they are read quickly. Keep headline and background at a contrast ratio of at least 4.5:1 for normal-size text. This script calculates the WCAG contrast ratio between two sRGB colours.
// WCAG 2.x contrast ratio between two sRGB colours given as [r, g, b] (0-255).
function luminance([r, g, b]) {
const lin = (v) => {
const c = v / 255;
return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
};
return 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b);
}
function contrastRatio(a, b) {
const [hi, lo] = [luminance(a), luminance(b)].sort((x, y) => y - x);
return (hi + 0.05) / (lo + 0.05);
}
console.log(contrastRatio([0, 0, 0], [255, 255, 255]).toFixed(1)); // 21.0Run it on your final palette, not only on the master. Overlays, gradients and photos change the background behind the text.
Common errors
- Wrong dimensions by a few pixels. The upload is rejected. Check the exact size in the file properties.
- A 1x export on a high-density screen. The ad looks soft. Supply a 2x version when the platform allows it.
- Text saved as JPG at low quality. Letters show noise. Switch to PNG or raise the quality.
- A CMYK or untagged file. Colours shift in the browser. Convert to sRGB.
- A banner with no border. A white banner on a white page disappears. Add a 1 px border inside the artboard when the spec allows it.
- Call to action at the edge. Platform overlays or rounded corners can hide it. Keep it inside the stated safe zone.
- Using a limit from an old project. Specs change. Read the current sheet each time.
Exercise
A spec sheet asks for a 728x90 static JPG under 150 KB. Your export at 1x is 28 KB. You also export a 2x version at 1456x180 pixels and it is 140 KB. The platform accepts only one file per placement and displays it at 728x90. Which file do you upload, and what do you check before you upload it?
Show answer
Upload the 2x file only if the sheet allows a file with those dimensions. Many sheets require the exact stated size, so the 1456x180 file would be rejected, and the safe choice is the 728x90 file. Before uploading, check that the file is exactly the stated dimensions, that it is under the weight limit as shown by your file manager, that it is a JPG in sRGB, and that the platform preview shows the text sharp and the call to action inside the safe zone. If the sheet explicitly accepts 2x files, the 2x file is sharper on high-density screens and its 140 KB still fits under 150 KB, but it leaves only 10 KB of margin, so confirm the weight again after any change.
Exercise
Choose the best format for each item and give one reason: (a) a photograph of a product on a beach, (b) a logo on a transparent background, (c) a 3-second animation of three text frames over flat colour.
Show answer
(a) JPG, because it compresses photographs well and the image needs no transparency. (b) PNG, because it is lossless and supports transparency, or SVG if the platform accepts it, because it is a vector. (c) GIF or HTML5, because the animation is simple and the colours are flat. HTML5 usually gives smaller files and sharper text when the platform accepts it, and GIF is the fallback when it does not.