How to calculate E-commerce Conversion Rate
E-commerce conversion rate is the percentage of store sessions that end in a purchase.
Formula
Conversion rate = orders ÷ sessions × 100SQL query
This example assumes: sessions(id, started_at, device), orders(id, session_id, status). It is written in PostgreSQL syntax; date functions differ slightly in MySQL, BigQuery and SQLite, and your column names will differ from these.
SELECT s.device,
COUNT(DISTINCT s.id) AS sessions,
COUNT(DISTINCT o.id) AS orders,
COUNT(DISTINCT o.id) * 100.0 / NULLIF(COUNT(DISTINCT s.id), 0) AS conversion_pct
FROM sessions s
LEFT JOIN orders o ON o.session_id = s.id AND o.status = 'paid'
WHERE s.started_at >= CURRENT_DATE - 30
GROUP BY s.device
ORDER BY conversion_pct DESC;Common mistakes that make E-commerce Conversion Rate wrong
- Bots inflate sessions and depress the rate.
- Customers who browse on mobile and buy on desktop appear as separate sessions.
- Comparing sessions with orders from a different time window misaligns the ratio.
Ask for E-commerce Conversion Rate in plain English
Instead of writing the query yourself, you can type the question. SchemaChat turns it into SQL against your connected database or uploaded file, runs it, and shows the SQL and the figures it used so you can check the answer before you share it. It does not replace your judgement about the definition: check that the query matches the formula your business uses.
- What is our conversion rate by device this month?
- How did conversion change after the checkout redesign?