How does a stock exchange really work?

We explain what happens when you click 'Buy'
How does a stock exchange really work?
August 12, 2022

Table of contents

Stock exchanges are the soul of the stock market.

Most people have a sort of idea of how an exchange might work but the real mechanisms that drive them can be a bit more obscure. Here are the basics!

Let’s dive in

A stock exchange is a pure vehicle of supply & demand. Historically, stock exchanges operated like bustling medieval markets or chaotic bazaars. Traders would shout out prices and deal directly with each other.

There are a small handful of exchanges which still have dealing pits like this, notably the London Metal Exchange. Now though, the vast majority of modern exchanges work purely electronically.

However, the underlying principle is still the same.

Institutional and professional investors, like bank traders, fund managers or highly committed personal traders, set their own prices at which they’re willing to buy and sell. The prices they set will usually be influenced by current prices, but it’s ultimately up to them. These orders all go onto the exchange’s ledger — a list of all buying and selling interests — which is called the order book.

An electronic system called a matching engine then matches up buyers and sellers on the book and completes the orders.

A super simple example

A buyer wants to buy 200 shares of Delicious Lemonade PLC. Based on his analysis and knowledge that everyone else is paying £98 — £102/share, he’s willing to buy at £100 a share and registers that interest on the order book.

If there’s someone who wants to sell 200 shares at £100 on the order book already then no problem at all. But it doesn’t necessarily line up so smoothly.

Let’s say instead there is a seller for 100 shares at £99, which is lower than the buyer’s price. Great!

However, our buyer wants 200 shares. There is another seller of 100 shares but she’s holding out for a better price: £101. However, the matching engine can combine those two sellers for an average cost of £100/share and fulfil the order.

What if there aren’t enough sellers to fulfil at £100/share and the only people selling want £102? If the buyer really wants the shares, he’ll put up a new order at £102 and pay more. That’s how the market price goes up.

Aggregated together, the most recent transactions like this create and shift the market price of a stock.

What if the buyer thinks the lemonade business is overrated and doesn’t want to pay a penny more than £85/share, while everyone else is paying around £100. Well, he can still place that order on the order book and wait to see if anyone takes him up. It’s unlikely unless conditions change, but it can happen.

However, his opinion and lowball price won’t normally have any direct impact on the market price until someone actually sells to him at £85/share.

Market makers

The order book is the main method for matching buys and sells efficiently. However, most exchanges also have other mechanisms to keep transactions moving smoothly.

This is where market makers come in.

Market makers are financial firms that agree to take the other side of orders to buy or sell certain stocks. They help make markets more liquid, meaning everyone is able to buy and sell relatively quickly. Liquidity is the extent to which a market lets you buy and sell at stable prices.

In a liquid market, you can buy and sell without worrying too much about whether your order will be matched or whether your transactions will dramatically shift prices. Market makers provide a constant flow of supply and demand. Buyers don’t have to depend on there being available sellers at the exact moment they want to purchase and vice versa.

Market makers quote a bid-offer spread: a lower price they’ll buy at and a higher price they’ll sell at.

Bid: I’ll buy this stock from you for e.g. £99

Offer: I’ll sell the same stock to you for e.g. £101

They don’t take a positive or negative position on the assets they cover; instead they aim to end up neutral and make money on the difference between their buying and selling price.

There are many different types of market maker and their exact role and obligations vary in different countries or exchanges. However, there are usually limitations on the transaction size they have to undertake.

They’re middlemen, but very useful ones.

Push it to the limit

Some brokerage platforms allow you to sit on the order book and set your own price too. These are commonly known as limit orders and stop losses. With a limit order, you set the price at which you’re happy to buy or sell and your order will go through if/when market price hits that level or better.

With a stop loss, you set a price at which you want to sell off your stock and likewise your broker automatically tries to sell it if the price declines to that point.

OK you’re (mostly) set

This is very much a simple overview of how exchanges work. Due to centuries of financial innovation, there are get-outs, nuances and counter-examples to fill textbooks!

However, this is the fundamental process: prices driven by the order book and the whole process kept in a steady flow by market makers. 💪

Learn more:

How to invest in stocks and shares

Savings vs investing - which is better?

Detailed guide to investment risk

How to choose the best investment app

Freetrade is on a mission to get everyone investing. Whether you’re just starting out or an experienced investor, you can buy and sell thousands of UK and US stocks, ETFs and investment trusts commission-free on our trading app. Download the Freetrade app today and join over 850,000 retail investors.

Important information

When you invest, your capital is at risk. The value of your investments can go down as well as up and you may get back less than you invest.

Freetrade does not give investment advice and you are responsible for making your own investment decisions. If you are unsure about what is right for you, you should seek independent advice.

Freetrade is a trading name of Freetrade Limited, which is a member firm of the London Stock Exchange and is authorised and regulated by the Financial Conduct Authority. Registered in England and Wales (no. 09797821).

Most read

Simple pricing plans

Choose how you'd like to pay:


Save 17%



Save 17%




GIA pink
General investment account


  • Commission-free trades (other charges may apply. See full pricing table.)
  • Trade USD & EUR stocks at the exchange rate + a 0.99% FX fee
  • Fractional US Shares
  • Access to more than 4,700 stocks, including the most popular shares and ETFs
  • 1% AER on up to £1,000 uninvested cash

£59.88 billed annually


Billed monthly


GIA white
General investment account
Stocks and shares ISA

Everything in Basic, plus:

  • Full range of over 6,000 US, UK and EU stocks and ETFs
  • Trade USD & EUR stocks at the exchange rate + a 0.59% FX fee
  • Automated order types, including recurring orders
  • Advanced stock fundamentals
  • 3% AER on up to £2,000 uninvested cash

£119.88 billed annually


Billed monthly


GIA white
General investment account
Stocks and shares ISA
SIPP white
Self-invested personal pension (SIPP)

Everything in Standard, plus:

  • Trade USD & EUR stocks at the exchange rate + a 0.39% FX fee
  • Priority customer service
  • Freetrade Web beta
  • 5% AER on up to £3,000 uninvested cash

Download the app to start investing now

When you invest your capital is at risk.