Main thread - Glossary | MDN Skip to main content Skip to search MDN HTML HTML: Markup language HTML reference Elements Global attributes Attributes See all… HTML guides Responsive images HTML cheatsheet Date & time formats See all… Markup languages SVG MathML XML CSS CSS: Styling language CSS reference Properties Selectors At-rules Values See all… CSS guides Box model Animations Flexbox Colors See all… Layout cookbook Column layouts Centering an element Card component See all… JavaScriptJS JavaScript: Scripting language JS reference Standard built-in objects Expressions & operators Statements & declarations Functions See all… JS guides Control flow & error handing Loops and iteration Working with objects Using classes See all… Web APIs Web APIs: Programming interfaces Web API reference File system API Fetch API Geolocation API HTML DOM API Push API Service worker API See all… Web API guides Using the Web animation API Using the Fetch API Working with the History API Using the Web speech API Using web workers All All web technology Technologies Accessibility HTTP URI Web extensions WebAssembly WebDriver See all… Topics Media Performance Privacy Security Progressive web apps Learn Learn web development Frontend developer course Getting started modules Core modules MDN Curriculum Check out the video course from Scrimba, our partner Learn HTML Structuring content with HTML module Learn CSS CSS styling basics module CSS layout module Learn JavaScript Dynamic scripting with JavaScript module Tools Discover our tools Playground HTTP Observatory Border-image generator Border-radius generator Box-shadow generator Color format converter Color mixer Shape generator About Get to know MDN better About MDN Advertise with us Community MDN on GitHub Blog Toggle sidebar Glossary Main thread Theme OS default Light Dark English (US) Remember language Learn more Deutsch English (US) Español Français 日本語 한국어 中文 (简体) Main thread The main thread is where a browser processes user events and paints. By default, the browser uses a single thread to run all the JavaScript in your page, as well as to perform layout, reflows, and garbage collection. This means that long-running JavaScript functions can block the thread, leading to an unresponsive page and a bad user experience. Unless intentionally using a web worker, such as a service worker, JavaScript runs on the main thread, so it's easy for a script to cause delays in event processing or painting. The less work required of the main thread, the more that thread can respond to user events, paint, and generally be responsive to the user. In this article See also See also Asynchronous JavaScript Web worker API Service worker API Related glossary terms: Thread Help improve MDN Was this page helpful to you? Yes No Learn how to contribute This page was last modified on Jul 11, 2025 by MDN contributors. View this page on GitHub • Report a problem with this content Filter sidebar Clear filter input Glossary Abstraction Accent Accessibility Accessibility tree Accessible description Accessible name Adobe Flash Advance measure Ajax Algorithm Alignment container Alignment subject Alpha (alpha channel) ALPN API Apple Safari Application context Argument ARIA ARPA ARPANET Array ASCII Aspect ratio Asynchronous ATAG Attribute Authentication Authenticator Bandwidth Base64 Baseline Baseline (compatibility) Baseline (typography) BCP 47 language tag Beacon Bézier curve bfcache BiDi BigInt Binding Bitwise flags Blink blink element (<blink> tag) Block Block (CSS) Block (scripting) Block cipher mode of operation Block-level content Boolean Boolean (JavaScript) Boolean attribute (ARIA) Boolean attribute (HTML) Bounding box Breadcrumb Brotli compression Browser Browsing context Buffer Bun Cache Cacheable CalDAV Call stack Callback function Camel case Canonical order Canvas Card sorting CardDAV Caret CDN Certificate authority Certified Challenge-response authentication Character Character encoding Character reference Character set Chrome CIA Cipher Cipher suite Ciphertext Class Client-side rendering (CSR) Closure Cloud Cloud computing CMS Code point Code splitting Code unit Codec Color space Color wheel Compile Compile time Composite operation Compression Dictionary Transport Computer programming Conditional Constant Constructor Content header Continuous integration Continuous media Control flow Cookie Copyleft CORS CORS-safelisted request header CORS-safelisted response header Crawler Credential CRLF Cross Axis Cross-site request forgery (CSRF) Cross-site scripting (XSS) CRUD Cryptanalysis Cryptography CSP CSS CSS Object Model (CSSOM) CSS pixel CSS preprocessor Cumulative Layout Shift (CLS) Data structure Database Debounce Decryption Deep copy Delta Denial of Service (DoS) Deno Descriptor (CSS) Deserialization Developer tools Device pixel Digital certificate Digital signature Distributed Denial of Service (DDoS) DMZ DNS Doctype Document directive Document environment DOM (Document Object Model) Domain Domain name Domain sharding Dominator DSL DSL (Digital Subscriber Line) DSL (Domain-Specific Language) DTLS (Datagram Transport Layer Security) DTMF (Dual-Tone Multi-Frequency signaling) Dynamic typing ECMA ECMAScript Effective connection type Element Encapsulation Encryption Endianness Engine JavaScript engine Rendering engine Entity Entity header Enumerated Escape character Event Exception EXIF Expando Extrinsic size Fallback alignment Falsy Favicon Federated identity Fetch directive Fetch metadata request header Fingerprinting Firefox OS Firewall First Contentful Paint (FCP) First CPU idle First Input Delay (FID) First Meaningful Paint (FMP) First Paint (FP) First-class function Flex Flex container Flex item Flexbox Flow relative values Forbidden request header Forbidden response header name Fork Fragmentainer Frame rate (FPS) FTP FTU Function Fuzz testing Gamut Garbage collection Gecko General header GIF Git Global object Global scope Global variable Glyph Google Chrome GPL GPU Graceful degradation Grid Grid areas Grid Axis Grid Cell Grid Column Grid container Grid lines Grid Row Grid Tracks Guaranteed-invalid value Gutters gzip compression Hash function Hash routing Head High-level programming language HMAC Hoisting HOL blocking Host Hotlink Houdini HPKP HSTS HTML HTML color codes HTML5 HTTP HTTP content HTTP header HTTP/2 HTTP/3 HTTPS HTTPS RR Hyperlink Hypertext IANA ICANN ICE IDE Idempotent Identifier Identity provider (IdP) IDL IETF IIFE IMAP Immutable IndexedDB Information architecture Inheritance Ink overflow Inline-level content Input method editor Inset properties Instance Interaction to Next Paint (INP) Internationalization (i18n) Internet Interpolation Intrinsic size Invariant IP Address IPv4 IPv6 IRC ISO ISP ITU Jank Java JavaScript Jitter JPEG JSON JSON type representation Just-In-Time Compilation (JIT) Kebab case Key Keyword Largest Contentful Paint (LCP) Latency Layout mode Layout viewport Lazy load Leading LGPL Ligature Literal Local scope Local variable Locale Localization Logical properties Long task Loop Lossless compression Lossy compression LTR (Left To Right) Main axis Main thread Markup MathML Media Media (Audio-visual presentation) Media (CSS) Media query Metadata Method Microsoft Edge Microsoft Internet Explorer Middleware MIME MIME type Minification MitM Mixin Mobile first Modem Modularity Mozilla Firefox Multi-factor authentication Mutable MVC Namespace NaN NAT Native Navigation directive Netscape Navigator Network throttling NNTP Node Node (DOM) Node (networking) Node.js Non-normative Nonce Normative Null Nullish value Number Object Object reference OOP OpenGL OpenSSL Opera browser Operand Operator Origin OTA OWASP P2P PAC Packet Page load time Page prediction Parameter Parent object Parse Parser Payload body Payload header PDF Perceived performance Percent-encoding PHP Physical properties Pixel Placeholder names Plaintext Plugin PNG Polyfill Polymorphism POP3 Port Prefetch Preflight request Prerender Presto Primitive Principle of least privilege Privileged Privileged code Progressive enhancement Progressive web applications (PWAs) Promise Property Property (CSS) Property (JavaScript) Protocol Prototype Prototype-based programming Proxy server Pseudo-class Pseudo-element Pseudocode Public-key cryptography Python Quality values Quaternion QUIC RAIL Random Number Generator Raster image Rate limit RDF Reading order Real User Monitoring (RUM) Recursion Reflow Registrable domain Regular expression Relying party Render-blocking Repaint Replaced elements Replay attack Repo Reporting directive Representation header Request header Resource Timing Response header Responsive Web Design (RWD) REST RGB RIL Robots.txt Round Trip Time (RTT) Router RSS Rsync RTCP (RTP Control Protocol) RTF RTL (Right to Left) RTP (Real-time Transport Protocol) and SRTP (Secure RTP) RTSP: Real-time streaming protocol Ruby Safe Safe (HTTP Methods) Salt Same-origin policy SCM Scope Screen reader Script-supporting element Scroll boundary Scroll chaining Scroll container Scroll snap SCTP SDK (Software Development Kit) SDP Search engine Secure context Secure Sockets Layer (SSL) Selector (CSS) Semantics SEO Serializable object Serialization Server Server Timing Server-side rendering (SSR) Session hijacking SGML Shadow tree Shallow copy Shim Signature Signature (functions) Signature (security) SIMD SISD Site Site map SLD Sloppy mode Slug Smoke test SMPTE (Society of Motion Picture and Television Engineers) SMTP Snake case Snap positions SOAP Social engineering Source map SPA (Single-page application) Specification Speculative parsing Speed index SQL SQL injection SRI Stacking context State machine Statement Static method Static site generator (SSG) Static typing Sticky activation Strict mode String Stringifier STUN Style origin Style sheet Submit button SVG SVN Symbol Symmetric-key cryptography Synchronous Syntax Syntax error Synthetic monitoring Table grid box Table wrapper box Tag TCP TCP handshake TCP slow start Telnet Texel The Khronos Group Thread Three js Throttle Time to First Byte (TTFB) Time to Interactive (TTI) TLD TOFU Top layer Transient activation Transport Layer Security (TLS) Tree shaking Trident Truthy TTL TURN Type Type coercion Type conversion TypeScript UAAG UDP (User Datagram Protocol) UI Undefined Unicode Unix time URI URL URN Usenet User agent UTF-8 UTF-16 UUID UX Validator Value Variable Vendor prefix Viewport Visual viewport Void element VoIP W3C WAI WCAG Web performance Web server Web standards WebAssembly WebDAV WebExtensions WebGL WebIDL WebKit WebM WebP WebRTC WebSockets WebVTT WHATWG Whitespace WindowProxy World Wide Web Wrapper XForms XHTML XInclude XLink XML XMLHttpRequest (XHR) XPath XQuery XSLT Zstandard compression MDN Your blueprint for a better internet. MDN About Blog Mozilla careers Advertise with us MDN Plus Product help Contribute MDN Community Community resources Writing guidelines MDN Discord MDN on GitHub Developers Web technologies Learn web development Guides Tutorials Glossary Hacks blog Mozilla Website Privacy Notice Telemetry Settings Legal Community Participation Guidelines Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.