How to Get HTML5 Animated Banner Ads Right
Learn how to plan, build and test HTML5 animated banner ads: sizes, file-weight budgets, animation length, clickTag tracking, backup images and accessibility.
On this page
- What exactly is an HTML5 banner, and how is it different from an animated GIF?
- Which sizes should an HTML5 banner set include?
- How heavy can an HTML5 banner be, and where does the weight go?
- How long should the animation run, and should it loop?
- How do you make sure the message still works if nobody watches the animation?
- Should you hand-code banners, use Google Web Designer, or build them in Adobe Animate?
- How do you build one banner set that passes every network's rules?
- How do click-throughs and tracking work in an HTML5 banner?
- What does accessibility require of an animated banner?
- What does a realistic banner production budget look like in time and weight?
- How should you test a banner set before launch?
- When is it worth bringing in a specialist studio for HTML5 banner ads?
- Working on something like this?
HTML5 animated banner ads are display ads built from HTML, CSS and JavaScript that move inside a fixed rectangle, under a strict file-weight limit, and have a few seconds to get a message across before the reader scrolls past. They replaced Flash as the standard for rich display advertising, and they are now what most ad networks, programmatic platforms and publisher ad servers expect when a campaign calls for motion. A single campaign can easily mean twenty or thirty individual files: several sizes, several messages, several networks, each with its own rules.
This guide is for marketers commissioning a banner set, in-house designers building one for the first time, and producers who have had a batch rejected and want to know why. It works through the questions people actually ask about html5 animated banner ads: what sizes to build, how heavy they can be, how long they should run, how click tracking works, what accessibility requires, and how to test before anything goes live. The answers lean on published standards where they exist and give ranges, with the reasons behind them, where the rules vary from network to network.
One principle runs through every section: a banner is a very small piece of software that has to behave predictably in an environment you do not control. The creative idea matters, but it only reaches anyone if the file passes upload checks, loads fast on a slow connection, tracks its clicks and still makes sense when it stops moving.
What exactly is an HTML5 banner, and how is it different from an animated GIF?
An HTML5 banner is a small web page packaged as a ZIP file, usually an index.html plus images, a stylesheet and a script, that an ad server loads into an iframe of a fixed size. An animated GIF is a single image file that plays a sequence of frames. That difference in structure explains almost every practical difference between them.
Because an HTML5 banner is code, it can render text and vector shapes sharply at any pixel density, animate with smooth easing at the display's refresh rate, reuse one image across many moves instead of storing every frame, and react to the viewer, for example by pausing on hover or revealing a detail on tap. It can also record events such as clicks, which the ad server reads through a shared convention. A GIF can do none of that. It is limited to 256 colors per frame, it stores motion as a stack of full or partial frames, so file size grows with length and smoothness, and it has no interactivity beyond a single click-through set by the ad server.
The GIF still has a place. Some email clients, older publisher placements and certain direct-sold slots accept only images, and a GIF is the simplest thing to traffic. Our guide to getting animated GIFs right covers when that format is the better call and how to keep its weight down. Newer image formats sit in between: animated WebP and APNG offer full color and better compression than GIF, but ad-platform support for them as creative is patchy, so check before planning a campaign around them.
What an HTML5 banner package usually contains
- index.html with the ad-size meta tag and the click-through variable the network expects.
- Images such as product shots, backgrounds and logos, compressed and often combined into a sprite sheet.
- CSS for layout and, in simple builds, the animation itself through keyframes and transitions.
- JavaScript for sequencing, click handling and any interactivity, sometimes with an animation library.
- A backup image, delivered alongside the ZIP rather than inside it on most platforms, shown wherever the HTML5 version cannot run.
Vector artwork is often the lightest way to carry logos and shapes. If your brand assets exist as clean SVG, the trade-offs in animated SVG apply directly to banners, since an inline SVG logo can weigh a fraction of the same logo as a high-resolution PNG.
Which sizes should an HTML5 banner set include?
Build the sizes your media plan actually buys, and take the dimensions from the network specifications and the IAB New Ad Portfolio rather than from memory. The IAB Tech Lab's New Ad Portfolio guidelines are the industry's reference for standard creative sizes and behavior, and most networks and publishers build their own specs on top of them.
Historically, display ads were defined by fixed pixel dimensions. The New Ad Portfolio moved toward flexible, aspect-ratio-based units that adapt to screens, while fixed sizes remain in wide use across networks. In practice, most banner sets still revolve around a handful of fixed sizes that appear in nearly every media plan, and a few that come and go depending on placement.
The key production decision is not which sizes exist, but how your layout family will adapt across very different shapes. A wide leaderboard, a tall skyscraper and a medium rectangle are not scaled versions of each other. The headline that fits comfortably on a medium rectangle has to be broken into two lines on a skyscraper and compressed to one short line on a leaderboard. Plan three layout archetypes rather than one layout resized many times:
- Horizontal formats (leaderboards and mobile banners) read left to right. The logo sits at one end, the message in the middle and the call to action at the other end. Vertical space is scarce, so type sizes are the binding constraint.
- Vertical formats (skyscrapers and half-page units) read top to bottom. They give room for a stacked sequence of messages and a larger product image, but a narrow width limits how long any line of text can be.
- Box formats (medium rectangles and squares) are the most flexible and usually the lead design. Most creative approval happens on this size first, and the others are adapted from it.
Mobile banners deserve their own attention. The smallest units leave room for little more than a logo, a few words and a button, and they are often seen on high-density screens, so images need to be prepared at 2x the CSS pixel size to stay sharp, which in turn pushes weight up. Designing the smallest size early, instead of last, avoids the common surprise of discovering at the end that the approved message simply does not fit.
How heavy can an HTML5 banner be, and where does the weight go?
Networks set strict limits on how much a banner may load initially, and the exact number depends on the network, the placement and sometimes the size, so the only reliable answer is the current specification for each destination. What is consistent is the structure: the IAB approach separates an initial load, which must stay small so the page is not slowed down, from a subsequent or "polite" load that can bring in more once the host page has finished loading.
Many self-serve networks enforce a single cap on the whole ZIP at upload and reject anything over it automatically. Publisher ad servers and programmatic platforms may allow a larger subsequent load. Commonly quoted caps for standard banners sit in the low hundreds of kilobytes for the initial load, but treat any figure you have seen before as a starting point to verify, not as a rule. Build to the strictest destination in your plan, and you will pass everywhere else.
Where the kilobytes actually go
In most banner sets, images are the largest line item by far, followed by any font files, then an animation library if one is bundled, with HTML, CSS and custom JavaScript making up a small remainder. That order tells you where to work:
- Images: export at the size they display (2x for high-density screens where it matters), choose JPEG for photographs and PNG only where you need transparency, and run everything through a compressor. A product cut-out with a soft shadow is often lighter as a JPEG composited onto the banner's background color than as a transparent PNG.
- Fonts: a full web font can outweigh the rest of the banner. Subset it to the characters actually used, or set short headlines as SVG outlines or images. System fonts cost nothing but break brand consistency.
- Libraries: an animation library is convenient, but it is also a fixed cost repeated in every file. Some networks, including Google's, host common libraries on their own content delivery network and do not count them toward the limit when referenced from there. Confirm this in the spec before relying on it.
- Code: minify HTML, CSS and JavaScript. Savings are small in absolute terms, but they are free.
| Asset type | Typical share of weight | Best lever | Common mistake |
|---|---|---|---|
| Photographic images | Largest | JPEG at display size, tuned quality | Exporting at print resolution or as PNG |
| Transparent cut-outs | Large | Flatten onto known background, or use PNG-8 | Full 24-bit PNG with alpha everywhere |
| Web fonts | Medium to large | Subset to used glyphs, or outline headlines | Bundling the full font family |
| Animation library | Medium | Use the network-hosted copy or plain CSS | Bundling a full library for three fades |
| Logos and icons | Small | Inline SVG | Large PNG logos with transparency |
| HTML, CSS, JavaScript | Small | Minify | Leaving debug code and unused rules in |
How long should the animation run, and should it loop?
Keep the animation short, cap the number of loops, and always end on a clear frame that shows the brand, the offer and the call to action. Networks commonly set a maximum animation length and a maximum number of loops, and the web accessibility standard sets a separate, stricter expectation about moving content, so the practical answer is shorter than most first drafts.
The accessibility rule is the one that constrains design most. Under WCAG success criterion 2.2.2, moving content that starts automatically, lasts more than five seconds and is presented alongside other content needs a mechanism for the user to pause, stop or hide it. A banner sits alongside the page's content by definition. That leaves two workable routes: finish all motion within five seconds, or provide a visible pause control. Many teams choose the first because it also produces tighter, more readable creative.
Endless looping is the mistake the brief warns about most often, and for good reason. Networks commonly reject it outright, it distracts readers from the content they came for, and it trains people to ignore the ad. If you loop, loop a small number of times and then stop on the end frame. A good pattern is to play the full sequence once, then on subsequent loops play only the last beat, or stop entirely.
Pacing within a short runtime
Short runtimes change how you pace motion. A three-scene sequence in five seconds gives each scene well under two seconds, which is barely enough to read five or six words. That is why the most effective banners usually have only two or three text beats and let the motion do the connecting work: a product slides in, the offer appears, the button settles. The discipline is the same as in very short video; the thinking in our piece on six-second bumper animation transfers almost directly, as does the way animation timing charts help you lay out holds and eases frame by frame before anyone builds anything.
A useful rule of thumb for reading time is to allow a hold of roughly a quarter to a third of a second per word for short headline copy, and more for numbers or prices, which readers slow down to check. If the copy will not fit in the time available, cut copy rather than shorten holds.
How do you make sure the message still works if nobody watches the animation?
Design the end frame first, and make it a complete ad on its own; then build the animation as a way of arriving at it. Most people see a banner in their peripheral vision for a moment, often after it has already finished playing, so any message that appears only in the middle of the sequence is effectively invisible to them.
This is the "messages that only appear mid-animation" mistake in the brief, and it is easy to make because storyboards are read sequentially in a meeting, where every frame gets full attention. In the wild, the first frame and the last frame carry almost all the value. The first frame has to earn a glance, and the last frame has to deliver everything the advertiser needs: who is advertising, what is on offer and what to do next.
A practical storyboard structure
- Frame 1, the hook. One strong visual or a short line that makes sense on its own. Include the logo if the brand is the hook.
- Frame 2, the proof or detail. The product, the price, or the feature that supports the hook. Optional in the smallest sizes.
- End frame, the resting state. Logo, offer and button, all legible, all in place, and nothing still moving.
A test that catches most problems: take a screenshot of the end frame of every size, put them side by side and ask whether each one works as a static ad. If any size needs the earlier frames to make sense, rework it. Then do the same with the first frame alone. Brand motion helps here too; a short logo resolve like the ones covered in animated logos and stings can serve as the transition into the end frame without adding weight if it is built from vector shapes.
Should you hand-code banners, use Google Web Designer, or build them in Adobe Animate?
All three produce valid HTML5 banners; the right choice depends on how many variations you need, who maintains them, and how much control you need over weight. Hand-coding gives the smallest and most predictable files, visual tools give designers direct control of timing, and larger programs of work often end up with a coded template driven by a data feed.
Google Web Designer is free and is built around display advertising, with ad-network environments that insert the correct click and metadata code for Google's platforms. Adobe Animate exports to HTML5 Canvas and suits teams with a Flash-era timeline workflow or complex frame-by-frame and character motion; our guide to HTML5 Canvas animation with Adobe Animate covers its runtime and export settings in detail. Hand-coded banners use plain HTML and CSS, perhaps with a light animation library, and are usually the lightest option.
Pros
- Hand-coding: smallest files, full control over every byte, clean handling of click code for any network, easy to template across sizes.
- Google Web Designer: visual timeline, built-in ad environments for Google platforms, no license cost, approachable for designers.
- Adobe Animate: rich timeline and drawing tools, strong for illustrated or character motion, familiar to motion designers.
Cons
- Hand-coding: needs a developer for every change, slower for designers to iterate on timing, easy to drift between sizes without a template.
- Google Web Designer: output can carry extra runtime code, and switching environments between networks takes care.
- Adobe Animate: Canvas output includes a runtime library that adds weight, and text rendered to canvas is not selectable or as sharp by default.
A pragmatic approach for most teams is to design and approve timing in whatever tool the motion designer prefers, then decide how to build based on volume. For a handful of files, the design tool's export is fine. For a large set, the time spent building a clean, parameterized template pays back quickly, because each new size or message becomes a configuration change instead of a rebuild.
CSS animation or JavaScript?
Simple sequences of fades, slides and scales run well as CSS keyframes and need no library at all. JavaScript earns its place when you need precise sequencing across many elements, interactive states, or a pause control that halts everything at once. Whichever you use, animate transform and opacity rather than properties such as width, top or left. Transforms and opacity can be handled by the browser's compositor, which keeps motion smooth on low-end phones while the host page is busy loading around the ad.
How do you build one banner set that passes every network's rules?
Read every destination's specification before designing, build one master template to the strictest combination of rules, and then create thin, network-specific exports that differ only in click handling and metadata. This is the hardest part of banner production, because the rules differ in small but fatal ways and upload checks are unforgiving.
The differences that cause rejections cluster in a few areas. Networks differ in the maximum file weight and whether it applies to the initial load or the whole package. They differ in the click-through convention: the name and casing of the variable, whether multiple exits are allowed and how they are declared. They differ in required metadata, such as the ad-size meta tag, and in which external requests are permitted. They differ in what counts as a loop, how long animation may run and whether audio or video are allowed. And they differ in accepted file types inside the ZIP and in folder structure; some reject nested folders, some reject certain file extensions, and most reject anything that calls resources from a server they do not recognize.
A specification matrix before the first frame
Before any design work, build a simple matrix with one row per destination and columns for size list, initial and total weight limits, animation length, loop limit, click convention, backup image requirements, permitted libraries and any border or background rules. Where two destinations disagree, the stricter value becomes the build target. Only click code and metadata should vary between exports; if anything else has to vary, note it explicitly so that no one "fixes" it back during revisions.
Insight: Most rejected banners are not rejected for creative reasons. They fail on mechanical details that a single specification matrix and a repeatable export step would have caught.
- Decide the strictest weight, length and loop limits across all destinations before design starts, and design to them.
- Keep click handling and metadata in one small, swappable part of the template so that network versions differ only there.
- Run each network's own validator or preview tool on every file, not just a sample, because a single missing tag fails the whole upload.
Version control matters more than it seems. A banner set with five sizes, three messages and three destinations is 45 files, and revisions tend to arrive as "change the price on all of them." Without a template and a naming convention that encodes size, message, network and version, the risk of shipping a stale file is high. Clear naming and packaging, as described in our guide to delivering animation source files, also means the next agency or in-house team can pick the set up without reverse-engineering it.
How do click-throughs and tracking work in an HTML5 banner?
The banner never hard-codes its landing page. Instead, it reads a click-through variable, commonly called clickTag, whose value the ad server fills in at serve time, and it opens that URL when the viewer clicks. This lets the ad server count the click, append tracking parameters and redirect to the landing page, and lets the trafficker change the destination without touching the creative.
The convention sounds simple, but it is where most functional bugs live. The variable name is case-sensitive, and networks do not all use the same one. Some expect a global variable declared in the HTML head; others provide their own function to call. A banner that works perfectly in a browser preview can fail silently in production because the click opens a placeholder URL, or opens nothing, or opens the landing page directly and bypasses the tracker, so clicks are never counted.
Common click-handling problems
- Only part of the ad is clickable. An invisible element on top, or a click handler bound to a single layer, leaves dead zones. The whole ad area should usually be the click target.
- Clicks are counted twice. Handlers attached to both a button and its container can fire together.
- The landing URL is hard-coded. The banner appears to work in testing but bypasses tracking in production.
- Multiple exits are declared incorrectly. Banners with separate product links need each exit declared in the way the network specifies, or the extra exits are ignored.
- Hover states swallow taps on mobile. Interactions designed for a mouse can require two taps on a touchscreen, which many viewers will not try.
Tracking beyond clicks, such as viewability and engagement events, is usually handled by the ad server or verification vendors rather than the creative itself. If the media plan requires custom events, confirm the mechanism in the specification, because unapproved external calls are a common reason for rejection.
What does accessibility require of an animated banner?
At minimum, an animated banner needs a way to pause motion that lasts more than five seconds, must not flash more than three times a second, and should give its content a text alternative so that screen reader users know what the ad is and where it leads. These expectations come from the Web Content Accessibility Guidelines, which the W3C's Web Accessibility Initiative publishes and explains, including the "Pause, Stop, Hide" success criterion.
Accessibility is sometimes seen as a constraint on banner creative, but in practice the requirements line up with what makes banners effective. Short motion that settles on a clear end frame is easier to read for everyone. Avoiding flashing removes a real risk for people with photosensitive conditions and also removes one of the most irritating effects in display advertising. The brief lists flashing effects as a mistake to avoid; strobing transitions, rapid color inversions and quick-cut sequences can all cross the flash threshold, so check any high-contrast, fast-changing section carefully.
Practical accessibility measures
- Keep total motion to five seconds or less, or add a visible, keyboard-reachable pause control that stops all motion at once.
- Respect reduced-motion preferences. A prefers-reduced-motion media query can skip straight to the end frame or replace movement with simple fades for users who have asked their system to minimize motion.
- Provide a text alternative. Give the clickable element an accessible name describing the advertiser and destination, not just "click here" or "learn more."
- Check contrast. Small type over photographs is the usual failure. A solid or semi-opaque panel behind text is more reliable than hoping the image cooperates.
- Keep text as text where possible. Live text stays sharp and is available to assistive technology, where text baked into images is neither.
Where the backup image fits in: what should it show, and when is it served?
The backup image is a static fallback that appears wherever the HTML5 version cannot run, for example in environments where scripts are blocked, in some older browsers and in certain placements that accept images only. It should be the end frame of the animation, exported as a lightweight JPEG, PNG or GIF at the exact ad size, carrying the brand, offer and call to action.
Networks vary in how they collect backup images. Some require them as separate uploads alongside the ZIP, some generate one automatically from the banner, and some expect a specific file name. Where the platform generates it, check the result, because an automatic capture taken at the wrong moment can show a half-animated frame or a blank background. The backup image also has its own size limit, usually much smaller than the HTML5 package, so compress it properly.
A useful side effect of making the end frame a complete ad is that the backup image becomes trivial to produce. If exporting the backup requires designing a new layout, that is a sign the end frame does not stand on its own and the animation needs reworking.
What does a realistic banner production budget look like in time and weight?
For a typical campaign, the weight budget is decided per file and the time budget is decided per set, and both are easier to manage when you plan them explicitly. The illustrative example below shows how the numbers work for a modest multi-network campaign.
Illustrative example: a five-size retail promotion
This example is illustrative, not a client project, and the limits are assumptions chosen for the arithmetic. Suppose a retailer runs a seasonal offer across three destinations, with five sizes each: a medium rectangle, a leaderboard, a wide skyscraper, a half-page and a mobile banner. There are two messages, a general sale and a category-specific offer. That is 5 sizes x 2 messages x 3 destinations, or 30 files, plus 30 backup images.
Assume the strictest destination caps the initial load at 150 KB per ZIP. A weight budget for the medium rectangle might look like this: a product photograph at 2x, compressed as JPEG, around 55 KB; a background texture around 20 KB; a subset brand font covering only the used characters around 25 KB; an inline SVG logo around 4 KB; HTML, CSS and a small custom script, minified, around 8 KB. That totals roughly 112 KB, leaving about 38 KB of headroom for revisions, which almost always add something. If the team had bundled a full animation library and the complete font family instead, the same banner could easily exceed the cap before any creative change.
The animation plan for this set runs 4.5 seconds: the product slides in over 0.6 seconds, the headline "Up to 30% off outdoor furniture" holds for about 1.8 seconds, the price detail swaps in over 0.4 seconds, and the end frame with logo and "Shop the sale" button settles at 4.5 seconds and stays. Because all motion finishes within five seconds, no pause control is required, and the banner plays once without looping.
On time, the lead size typically takes the most effort, since it carries design exploration and client approvals. Once it is approved, adapting to the other four sizes and to the second message is mostly layout work, and the three network exports are mechanical if the template separates click code and metadata. The final step, validating all 30 files in each network's preview tool and testing every click, is often underestimated and should be planned as its own task.
How should you test a banner set before launch?
Test every file, not a sample: weight, animation length, end frame, click-through, backup image and the network's own validation. Most launch problems come from one file in a set that differed from the rest, and checking only the lead size will not catch it.
- Validate against the specification matrix. Confirm dimensions, file weight, file types, folder structure and required meta tags for every file and every destination.
- Run the network's validator. Upload or preview each ZIP in the network's own tool, which catches problems that a browser test cannot, such as missing click variables or disallowed external calls.
- Time the animation. Watch every size from load to rest with a stopwatch or screen recording, and check loop counts and the final frame.
- Test clicks with tracking in place. Click every part of every ad, including edges and the end frame, and confirm the click reaches the tracker and then the landing page with parameters intact.
- Check on real devices. Test on at least one lower-end phone and one high-density screen for smoothness, sharpness and tap behavior.
- Check accessibility. Confirm reduced-motion behavior, flashing, contrast and the pause control if one is needed.
- Review backup images. Open each backup at full size and confirm it matches the end frame and meets its own weight limit.
After launch, keep an eye on the first day's delivery reports. A banner with a broken click-through shows up quickly as impressions with zero clicks, and a banner that was silently swapped for its backup image may show normal clicks but no engagement events. Catching either in the first hours saves most of the budget.
- Specifications collected for every destination before design started
- End frame works as a complete static ad in every size
- All motion finishes within five seconds, or a pause control is provided
- No flashing more than three times per second
- Loop count within the strictest network limit, ending on the end frame
- Every ZIP under the strictest weight limit, with headroom for revisions
- Click-through uses the network's variable, never a hard-coded URL
- Backup image supplied for every file, at the exact size and within its limit
- Each file passed the network's own validator
- File names encode size, message, destination and version
When is it worth bringing in a specialist studio for HTML5 banner ads?
Bring in help when the set spans many sizes and networks, when the campaign has frequent message changes, or when the internal team has design skills but not a repeatable build and test process. A single medium rectangle for one network is well within reach of most in-house designers using a visual tool. The difficulty scales with the number of combinations, not with the creativity of any one file.
The signs that a set has outgrown in-house production are practical: files rejected at upload and fixed one at a time, click-throughs discovered broken after launch, revisions that update some sizes but not others, and weight limits reached before creative is finished. A studio that builds banners regularly will usually bring a tested template, a specification library for the major networks, a naming and versioning system and a quality assurance checklist, which together remove most of those problems.
It also helps to see banners as part of a wider motion system. The same product animation, logo resolve and typographic style can run across banners, social cutdowns and web pages if they are designed that way from the start. Our web animation service covers banners alongside other lightweight motion for sites and campaigns, so the display ads and the landing page they point to can share the same visual language.
When briefing any partner, provide the media plan with every size and destination, the network specifications or at least the list of networks, brand assets in vector form, the approved copy for each message, landing URLs and tracking requirements, and a clear owner for approvals. Those inputs, more than anything else, decide how fast a banner set gets from first draft to live.
Verdict Getting HTML5 animated banner ads right is mostly a matter of discipline rather than invention: design the end frame first, keep motion short and flash-free, build to the strictest specification in the plan, never hard-code the landing page, supply a proper backup image and test every file before launch. Do that, and the creative has a fair chance to do its job; skip it, and even strong ideas get stuck at the upload screen.
Where this comes from
- IAB Tech Lab — IAB New Ad Portfolio
- W3C Web Accessibility Initiative — Understanding Success Criterion 2.2.2 Pause, Stop, Hide
The figures and practices above come from the sources listed.
Working on something like this?
We take on Motion Graphics & Animation work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.
Where to go next
Spotted something wrong? Report an error on this page. We correct on the page and say what changed.





