Gecko is the open-source browser engine developed by Mozilla that turns HTML, CSS, images and scripts into the interactive pages shown in Firefox and several related browsers. Among browser technologies it is one of the three major engine families still in active development, alongside WebKit and Blink, and it is the only one of the three that does not descend from the KHTML code base.
As a rendering engine in the broad sense, Gecko covers parsing, style computation, layout, painting and compositing, and it hosts the SpiderMonkey JavaScript engine together with networking, security and media components. Its independent implementation matters for the web as a whole, because standards gain credibility when multiple engines implement them interoperably.
How Gecko turns markup into pixels
Gecko processes a page through a pipeline of stages that mirrors the critical rendering path common to all modern engines. The HTML parser builds the DOM tree, the style system matches CSS rules and computes values for every element, the layout engine builds a frame tree with sizes and positions, and the rendering stages produce display lists that are rasterized and composited on the screen.
| Stage | Gecko component | Output |
|---|---|---|
| Parsing | HTML5 parser, running off the main thread | DOM tree |
| Style | Stylo, a parallel style system written in Rust | Computed styles |
| Layout | Frame constructor and reflow | Frame tree with geometry |
| Display list building | Painting code that walks the frame tree | Display list of drawing items |
| Rasterization and compositing | WebRender on the GPU | Pixels on screen |
Two components distinguish modern Gecko from its earlier versions. Stylo computes styles across all CPU cores in parallel, which reduces style recalculation time on complex pages. WebRender treats the page like a scene in a game engine and renders it on the graphics processor, aiming to keep frame production within the roughly 16.7 milliseconds available at 60 frames per second.
Architecture and key components of Gecko
Gecko is larger than its layout code. The engine runs inside a multi-process architecture, known by the project name Electrolysis and extended by site isolation under the name Fission, in which web content runs in separate sandboxed content processes while the parent process handles the browser interface, networking coordination and privileged operations.
| Component | Role | Notable trait |
|---|---|---|
| SpiderMonkey | JavaScript and WebAssembly execution | Interpreter plus baseline and optimizing JIT tiers |
| Necko | Networking library | HTTP/2, HTTP/3, caching and proxy support |
| Stylo | CSS style computation | Parallel, written in Rust |
| WebRender | GPU-based rendering | Retained scene, written in Rust |
| Fission | Site isolation | Separate processes per site |
| NSS | Cryptography and TLS | Mozilla’s own security library |
Gecko also renders the Firefox user interface itself, historically through a markup language called XUL and today increasingly through standard HTML and custom elements. This means the same engine paints both web content and browser chrome, a design choice that differs from browsers whose interface is built with separate native toolkits.
Gecko compared with Blink and WebKit
Gecko, Blink and WebKit implement the same web standards but come from different code lineages and governance models. Blink, used by Chromium and the many browsers built on it, forked from WebKit in 2013. WebKit powers Safari and, because of platform rules on iOS, historically every browser on that system. Gecko descends from the Netscape code released in 1998 and was largely rewritten afterwards.
| Property | Gecko | Blink | WebKit |
|---|---|---|---|
| Main browser | Firefox | Chrome and Chromium-based browsers | Safari |
| Steward | Mozilla | Google with Chromium contributors | Apple with contributors |
| JavaScript engine | SpiderMonkey | V8 | JavaScriptCore |
| Origin | Netscape code base | Fork of WebKit | Fork of KHTML |
| Language highlights | C++ and Rust | C++ | C++ |
The practical differences for developers are mostly in edge cases and feature timing. A new CSS or JavaScript feature may ship in one engine months before another, and subtle differences in layout rounding, form control styling or font rendering can appear. Testing in Gecko is therefore a meaningful part of cross-browser compatibility, not a formality.
Where Gecko is used and how to target it
Gecko ships mainly in Firefox for desktop and Android and in browsers derived from Firefox, such as privacy-focused forks and the Tor Browser. Mozilla also offers GeckoView, an Android library that lets applications embed the engine. On iOS, Firefox has historically used WebKit because of platform requirements, so the Gecko engine is absent there unless rules permit alternative engines in a given region.
Developers identify Gecko by feature detection, not user agent strings. The Firefox user agent contains the token Gecko followed by a fixed date-like value that no longer reflects the build, and other engines include the word in their own strings for compatibility. Checking for a specific API or CSS support with CSS.supports() is the reliable approach.
| Situation | Recommended approach | Reason |
|---|---|---|
| Feature may be missing | Feature detection with fallback | Works across engines and versions |
| Layout differs slightly | Test in Firefox during development | Rounding and form styling vary |
| Vendor-prefixed CSS | Prefer the standard property | Most -moz- prefixes are obsolete |
| Debugging rendering | Firefox Developer Tools | Exposes Gecko-specific inspectors |
Limitations and common misconceptions about Gecko
Several misunderstandings surround Gecko, often because the name appears in places unrelated to the engine itself. Clearing them up helps developers interpret compatibility reports correctly.
- The Gecko token in user agents appears in Chrome and Safari strings too, so it does not prove the engine is Gecko.
- Gecko is not a JavaScript engine; SpiderMonkey runs scripts while Gecko hosts it and handles the rest of the pipeline.
- Firefox on iOS is not Gecko-based in most regions, so iOS testing does not cover Gecko behavior.
- A smaller market share does not mean lower standards support; Gecko often implements specifications early and contributes to their tests.
- Embedding is harder than with Chromium, because Gecko offers fewer maintained embedding options outside Android.
A genuine limitation is ecosystem reach. Because fewer products embed Gecko, some web applications are tested primarily against Blink and contain assumptions that break in Firefox. Teams that include Gecko in their test matrix tend to discover standards violations in their own code that other engines silently tolerate.
In everyday language
A web page arrives as text written in special languages. Something inside the browser must read that text, decide where every heading, picture and button goes, and draw the result on your screen. That something is the browser engine, and Gecko is the engine inside Firefox.
Think of it as the kitchen behind a restaurant. Different restaurants can follow the same recipe and still serve slightly different dishes. In the same way, several engines follow the same web rules, and Gecko is one of the few independent kitchens left, which helps keep the rules fair and shared.
Seen in the real world
A small team launches a booking form for a regional clinic. It works in Chrome and Safari, but patients using Firefox report that the date field shows a different layout and that a sticky summary panel overlaps the submit button on narrow screens.
A developer opens the page in Firefox Developer Tools and uses the layout inspector to examine the flex container. The panel relies on a height calculation that Blink happened to tolerate while Gecko followed the specification more strictly. Replacing a fixed height with min-height and adding a feature-detected fallback for the date picker fixes both problems.
The team then adds Firefox to its automated cross-browser test suite. Over the next quarter the Gecko runs catch two more layout regressions before release, and support requests about the form drop to almost none.