🧠 Trivia Quiz Generator
Test your knowledge with random trivia questions. Choose category, difficulty, and question count. Powered by Open Trivia DB. Free — no signup.
Ready to Test Your Knowledge?
Answer 10 random trivia questions across science, history, technology, and geography.
What Trivia Quiz Generator Does
This quiz pulls ten multiple-choice questions at random from the Open Trivia Database, across all 24 of its categories, and scores you as you go.
Every question is community-submitted and moderated before publication. That is worth knowing because it explains both the strength and the weakness of free trivia data: the catalogue is broad and free, and the correctness of any single question rests on a volunteer reviewer rather than an editorial process.
The database is smaller than it appears from the inside. Measured on 11 September 2026 it held 5,298 verified questions — and 10,911 further questions awaiting review, a backlog more than twice the size of what is actually served.
How to Use Trivia Quiz Generator
- Select a category and difficulty level
- Choose the number of questions
- Click "Start Quiz" to begin
- Answer each question and see your score
Formula Used by Trivia Quiz Generator
What a guess is worth, and what a score means
expected score = questions × (1 ÷ options)
- questions
- 10 per round
- options
- 4 — this quiz requests multiple-choice only, never true/false
Worked example
Pure guessing, and the alternative of a true/false round.
- Multiple choice: 10 × (1 ÷ 4) = 2.5 expected
- True/false: 10 × (1 ÷ 2) = 5.0 expected
Result: Scoring 5 out of 10 here is genuine knowledge; scoring 5 out of 10 on a true/false quiz is exactly what a coin achieves. This quiz requests type=multiple for that reason — a true/false round cannot distinguish a player from a coin.
Why option order has to be shuffled properly
Array.prototype.sort() with no comparator sorts by string, not at random
- no comparator
- Elements are coerced to strings and compared lexicographically
- lexicographic
- "10" sorts before "2", because "1" precedes "2"
Worked example
A question whose four answers are the numbers 2, 4, 10 and 30.
- Intended: a random order, or failing that a numeric one
- Actual with a bare .sort(): ["10", "2", "30", "4"]
Result: Numeric answers rendered in an order that looks broken, and every question presented in a fixed alphabetical sequence rather than a shuffled one. Replaced with Fisher-Yates, which produces a genuinely uniform order — the same fix the flag quiz on this site needed.
Open Trivia Database, Measured
From the api_count_global and api_category endpoints on 11 September 2026.
| Measure | Value |
|---|---|
| Verified questions served | 5,298 |
| Questions pending review | 10,911 |
| Categories | 24 |
| Difficulty levels | 3 — easy, medium, hard |
| Question types | 2 — multiple choice and true/false |
What the Response Code Means
OpenTDB returns a response_code in the body. A wrapper that only checks the HTTP status will misread several of these as success.
| Code | Meaning |
|---|---|
| 0 | Success — questions returned |
| 1 | No results: the database has fewer questions than requested for those filters |
| 2 | Invalid parameter |
| 3 | Session token not found |
| 4 | Session token exhausted — every question for that token has been returned |
Why a Round Sometimes Repeats Itself
Three distinct causes, which look identical unless the tool distinguishes them.
| Cause | What you see |
|---|---|
| Rate limited | OpenTDB allows roughly one request every five seconds per address and answers 429 |
| API unreachable | Network failure or timeout |
| Random overlap | Ten questions drawn at random from 5,298 will occasionally repeat one you have seen |
How to Read Your Result
The moderation backlog is the real story about free trivia data
Twice as many questions sit pending review as are actually published. That backlog is the quality control working — submissions are held until a volunteer checks them — and it is also the reason the catalogue grows slowly. The practical consequence for a player is that a served question has been looked at by someone, which is better than most free trivia sources manage, and is still not the same as editorial verification. If an answer looks wrong to you, it may well be, and the database has a reporting mechanism for exactly that.
A silent fallback is worse than a visible failure
OpenTDB rate limits hard — a second request within a few seconds returns 429. The obvious way to handle that is a local bank of questions, and the obvious mistake is serving it without saying so. This tool holds exactly ten stored questions, so a fallback round is always the same ten in a different order, and a player who pressed "Play Again" too quickly previously got that with no indication anything had changed. The round now says plainly when it is stored rather than live, and why. A tool that quietly substitutes local data for remote data teaches its user to trust something that is not there.
Multiple choice is the only format that measures anything
With two options, a coin scores 50%. With four, random guessing averages 25%, so the gap between guessing and knowing is wide enough to mean something over ten questions. It is a small design decision with a real effect on whether a score is informative, and it is the reason this quiz requests type=multiple rather than accepting whatever mix the API would otherwise return. The same logic applies to reading any quiz result: ask how many options there were before deciding whether a percentage is impressive.
HTML entities are the standard trap in this API
OpenTDB's questions contain quotation marks, ampersands and accented characters, and by default it returns them HTML-encoded — so a question about a film arrives containing " and &. Wrappers that render the string directly show the raw entities; wrappers that decode by assigning the response to innerHTML push a remote string through an HTML parser to do it. The API offers encode=url3986, which sidesteps both by returning percent-encoded text that decodeURIComponent handles. This tool uses it.
Limitations & Accuracy Notes
- A wrapper over the Open Trivia Database. No questions are written here and question quality is entirely theirs.
- Questions are community-submitted and volunteer-moderated, not editorially verified. Errors do occur.
- Ten questions per round, drawn randomly across all categories and difficulties. There is no category filter, no difficulty setting and no timer.
- OpenTDB rate limits to roughly one request every five seconds. Starting rounds in quick succession will hit it.
- When the API is unavailable the quiz serves ten stored questions — always the same ten — and labels the round as stored rather than live.
- No session token is used, so the same question can recur across rounds.
- English only, and no score history, leaderboard or account.
Frequently Asked Questions
What trivia categories are available?
How does the scoring system work?
Where do the questions come from?
Are the answers reliable?
Why did I get the same ten questions again?
Why multiple choice rather than true/false?
Can I pick a category or difficulty?
Is my score saved?
References & Further Reading
- Open Trivia Database — API documentation — Reference for the endpoint parameters, the response_code values, the encode=url3986 option and the rate limit
- Open Trivia Database — global question count — Source of the measured 5,298 verified and 10,911 pending questions on 11 September 2026
- Open Trivia Database — category list — Source of the 24-category count