A single page application loads once, then updates itself without reloading

A single page application (or SPA) is a website that loads a single HTML page, then uses JavaScript to swap out the content on that page as you click around. Instead of your browser requesting a new page from the server every time you navigate, the application fetches only the data it needs and rewrites what you see on screen.

The difference shows up immediately. When you use Gmail, Google Maps, or Figma, you notice the page never flashes white or goes blank — it just changes. That's because these are SPAs. When you use a traditional website, each click sends a request to the server, waits for a new page to arrive, and your browser displays it. An SPA skips that wait.

You interact with an SPA the same way you interact with any website, but the machinery underneath is different. The browser does more of the work. The server sends less data. The experience feels faster because nothing has to reload.

Key Takeaways

  • A single page application loads one HTML file, then JavaScript changes what you see without the page reloading or going blank.
  • SPAs fetch only the data they need from the server, not entire new pages, which makes navigation feel faster and smoother.
  • Common examples include Gmail, Google Maps, Figma, Slack, and Trello — all applications that update instantly as you interact with them.
  • SPAs require more JavaScript to run in your browser, which means they can be slower to load the first time but faster to use afterward.
  • Traditional websites send a new page for each click, while SPAs send only data and let your browser decide what to display.

How an SPA differs from a traditional website

A traditional website works like ordering from a restaurant counter. You ask for something, the kitchen makes it, and they hand you a complete plate. Every time you want something different, you go back to the counter, wait for the kitchen to prepare it, and get a new plate. In browser terms, each click sends a request, the server builds a complete HTML page, and your browser displays it.

An SPA works more like a food truck with a digital menu. The truck arrives once (the initial page load). After that, you just tell it what to change on the menu board, and it updates the display without driving away and coming back. The browser already has the machinery to show things; it just needs new information about what to show.

When you click a link in a traditional website, your browser goes blank for a moment while it waits for the server to send the next page. When you click a link in an SPA, the page stays responsive. JavaScript running in your browser fetches the data it needs, updates the HTML that's already there, and you see the change almost instantly. Gmail does this — you click a folder, and the message list changes without the page reloading.

This also means SPAs can work better when your internet connection is slow or unreliable. Once the application is loaded, it can cache data locally and continue working even if the connection drops temporarily. A traditional website would simply stop.

Why developers build single page applications

Developers choose to build SPAs because they can create experiences that feel more like desktop software than websites. When nothing reloads, the application feels responsive and immediate. Users don't watch loading screens between actions. This matters for applications where you're doing a lot of back-and-forth work — writing emails, editing documents, moving tasks around a board.

SPAs also let developers separate the front end (what you see) from the back end (where the data lives). The browser handles displaying things and responding to clicks. The server handles storing data and running calculations. This separation makes it easier for teams to work on different parts without stepping on each other's code.

For companies, SPAs can reduce server load. Instead of the server building a new page for every click, it just sends data. One server can handle more users because it's doing less work per request. This saves money on infrastructure.

SPAs also work well on mobile devices. Once loaded, they use less data because they're only fetching the information that changed, not entire new pages. For users on limited data plans, this matters.

The trade-off: slower first load, faster after that

An SPA takes longer to load the first time you visit because your browser has to download all the JavaScript code that makes the application work. A traditional website might load faster initially because it only sends the HTML for that one page. But after the SPA is loaded, everything else is faster.

This is why some SPAs show you a loading screen when you first arrive. They're downloading the entire application. Once that's done, clicking around feels instant. A traditional website never has that initial wait, but every click triggers a new wait.

Developers try to solve this by splitting the JavaScript into chunks. Instead of downloading everything at once, the browser downloads only the code it needs right now and fetches the rest in the background. This is called code splitting, and it makes the first load faster without sacrificing the speed you feel while using the application.

Common examples of single page applications

Gmail is the most recognizable SPA. You load Gmail once, and then everything — reading mail, composing, searching, organizing into folders — happens without the page reloading. Google Maps is another. You pan around, zoom in and out, and search for places, all without a single page reload.

Figma (the design tool), Slack (the messaging platform), Trello (the task board), and Notion (the note-taking app) are all SPAs. So is Spotify's web player. Any application where you expect to click around and have things change instantly is probably an SPA.

Not all websites are SPAs. News sites, blogs, and documentation sites are usually traditional websites because there's no advantage to being an SPA. You read an article, click to the next one, and a new page loads. That's fine. SPAs make sense when the user is doing a lot of interactive work in one place.

What happens in your browser when you use an SPA

When you first visit an SPA, your browser downloads the HTML file (which is usually very small), then downloads all the JavaScript code. That JavaScript code contains the entire application. Once it's loaded, the application runs inside your browser.

When you click something, JavaScript intercepts that click. Instead of letting the browser navigate to a new page, the JavaScript code decides what to do. It might fetch new data from the server, update the HTML that's already on the page, and show you the result. Your browser's address bar changes to reflect where you are in the application, but the page itself never reloads.

This is why the back button still works in SPAs. The application keeps track of where you've been and updates the address bar so the browser history works normally. When you click back, the application loads the previous state from memory or fetches it from the server again.

Challenges with single page applications

SPAs are harder to build than traditional websites. Developers have to write more code to handle all the things the browser used to do automatically. They have to manage what data is loaded, what's cached, what happens when the connection drops, and how to keep everything in sync.

SPAs can also be harder for search engines to understand. Search engines like Google crawl websites by following links and reading HTML. An SPA doesn't send HTML for each page — it sends JavaScript that builds the HTML in your browser. Search engines have gotten better at running JavaScript, but it's still more complicated than crawling a traditional website.

If JavaScript breaks or doesn't load, an SPA might not work at all. A traditional website degrades gracefully — you might not get all the features, but you can still read the content. An SPA with broken JavaScript can be completely unusable.

SPAs also use more memory and battery on your device because JavaScript is running constantly. A traditional website loads a page and then mostly sits idle. An SPA keeps code running to listen for clicks, fetch data, and update the display.

Frequently Asked Questions

Is every modern website a single page application?

No. SPAs are useful for interactive applications like Gmail or Figma, but they're overkill for websites where you're mostly reading content. News sites, blogs, and documentation are usually traditional websites. The choice depends on what the user is doing.

Do I need to do anything different to use an SPA?

No. You use an SPA exactly like any other website. You click links, fill out forms, and navigate around. The difference is invisible to you — it's how the application works behind the scenes.

Why does an SPA sometimes feel slow even though it's supposed to be fast?

The first time you load an SPA, it can be slow because your browser is downloading all the JavaScript code. After that, it should feel fast. If an SPA feels slow while you're using it, it might be because the server is slow to send data, or the JavaScript code itself is inefficient.

Can an SPA work offline?

Some SPAs can work offline or with a poor connection because they cache data locally on your device. However, most SPAs need to connect to the server to fetch new data or save your changes. The application can continue running, but you might not be able to do everything.

What programming languages are used to build SPAs?

JavaScript is the only language that runs in browsers, so all SPAs use JavaScript. Developers often use frameworks like React, Vue, or Angular to make building SPAs easier. These frameworks handle the complex parts of managing what's on screen and keeping everything in sync.