Gecko

On this page 7

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.

StageGecko componentOutput
ParsingHTML5 parser, running off the main threadDOM tree
StyleStylo, a parallel style system written in RustComputed styles
LayoutFrame constructor and reflowFrame tree with geometry
Display list buildingPainting code that walks the frame treeDisplay list of drawing items
Rasterization and compositingWebRender on the GPUPixels on screen
Main stages of the Gecko rendering pipeline

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.

ComponentRoleNotable trait
SpiderMonkeyJavaScript and WebAssembly executionInterpreter plus baseline and optimizing JIT tiers
NeckoNetworking libraryHTTP/2, HTTP/3, caching and proxy support
StyloCSS style computationParallel, written in Rust
WebRenderGPU-based renderingRetained scene, written in Rust
FissionSite isolationSeparate processes per site
NSSCryptography and TLSMozilla’s own security library
Major components inside and around Gecko

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, 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.

PropertyGeckoBlinkWebKit
Main browserFirefoxChrome and Chromium-based browsersSafari
StewardMozillaGoogle with Chromium contributorsApple with contributors
JavaScript engineSpiderMonkeyV8JavaScriptCore
OriginNetscape code baseFork of WebKitFork of KHTML
Language highlightsC++ and RustC++C++
Comparison of the three major browser engines

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.

SituationRecommended approachReason
Feature may be missingFeature detection with fallbackWorks across engines and versions
Layout differs slightlyTest in Firefox during developmentRounding and form styling vary
Vendor-prefixed CSSPrefer the standard propertyMost -moz- prefixes are obsolete
Debugging renderingFirefox Developer ToolsExposes Gecko-specific inspectors
Recommended ways to handle behavior specific to Gecko

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.