😂 Joke Generator
Get random jokes in multiple categories — programming, puns, dark humor, and more. Free joke generator powered by JokeAPI. No signup required.
Requests are sent with JokeAPI's safe-mode and all six content flags blacklisted, and the response is checked for the safe marker before anything is shown.
What Joke Generator Does
This tool pulls a random joke from JokeAPI, filtered for safe content, in a chosen category. Jokes come back in one of two shapes: a single line, or a setup and a punchline that stays hidden until you ask for it.
Filtering here is stricter than it looks. JokeAPI defines six content flags — nsfw, religious, political, racist, sexist and explicit — and every request from this page blacklists all six and additionally sends safe-mode, the API's own stronger guarantee. The response carries a safe marker, which is checked before anything is displayed.
One consequence worth knowing up front: safe-mode narrows the catalogue sharply. JokeAPI holds 1,368 jokes across all languages and flags; 183 of them are English and marked safe. Expect repeats.
How to Use Joke Generator
- Select a joke category (or "Any")
- Click "Get Joke" to fetch a random joke
- Read and enjoy!
- Click again for another joke
Formula Used by Joke Generator
How quickly a 183-joke pool repeats
P(no repeat in n draws) = (1 − 1/N)(1 − 2/N) … (1 − (n−1)/N)
- N
- 183 — English jokes passing safe-mode
- n
- Number of jokes drawn
Worked example
Independent random draws from the safe English pool.
- After 10 draws, the chance of having seen no repeat is 77.9%
- After 17 draws it is 46.5% — a repeat has become more likely than not
- After 30 draws it is 8.1%
Result: This is the birthday problem. Repeats arrive far sooner than a catalogue of 183 suggests: by the seventeenth press of the button, most people will already have seen the same joke twice. That is the pool being small, not the tool malfunctioning.
JokeAPI Catalogue, Measured
From the API's own /info endpoint on 11 September 2026, running version 2.3.3.
| Measure | Value |
|---|---|
| Total jokes, all languages and flags | 1,368 |
| English jokes passing safe-mode | 183 |
| Categories | 7 — Any, Misc, Programming, Dark, Pun, Spooky, Christmas |
| Joke types | 2 — single, twopart |
The Six Content Flags
JokeAPI's complete flag list. Every request from this page blacklists all six. A generator that blacklists a subset will serve the rest.
| Flag | What it marks |
|---|---|
| nsfw | Not suitable for a workplace |
| religious | Jokes about religion or religious figures |
| political | Jokes about politics or politicians |
| racist | Racial content |
| sexist | Content targeting a gender |
| explicit | Explicit language or subject matter |
Categories Offered Here
JokeAPI's Dark category is deliberately not offered on this page. Miscellaneous is an alias the API accepts for Misc.
| Category | Content |
|---|---|
| Any | Draws from every category this page offers |
| Programming | Developer and computing humor |
| Pun | Wordplay |
| Miscellaneous | General jokes that fit nowhere else |
| Spooky | Halloween and horror themed |
How to Read Your Result
Blacklisting a subset of the flags is the common bug
JokeAPI accepts a blacklistFlags parameter listing which categories of content to exclude, and the failure mode is passing some of them. A generator that blacklists nsfw, racist, sexist and explicit but omits religious and political will happily serve religious and political jokes while presenting itself as filtered — which is precisely what this page did before it was fixed. safe-mode is the more robust control because it is a single switch maintained by the API rather than a list a developer has to keep complete, and the returned joke carries a safe marker that can be checked independently.
A two-part joke is structurally different, not just longer
The API returns type "single" with a joke field, or type "twopart" with separate setup and delivery fields. That distinction is the reason this page hides the punchline behind a button rather than printing both lines at once: the API has already told it where the joke breaks. A wrapper that concatenates the two fields and prints them together throws away the only piece of structure the format provides, and reading a setup and punchline simultaneously is a measurably worse way to encounter a joke.
When it fails, it fails with a 200
JokeAPI signals problems in the response body rather than the HTTP status — a request that matches nothing returns 200 with {"error": true, "code": 106}. A wrapper that checks only res.ok reads a joke field that does not exist, gets undefined, and renders an empty box with no explanation. This is a general pattern worth recognizing across free APIs: the status code and the body can disagree, and the body is usually the one telling the truth.
Limitations & Accuracy Notes
- A wrapper over JokeAPI. Nothing here is written locally and the catalogue is entirely theirs.
- Safe-mode restricts the English pool to 183 jokes, so repeats are frequent and expected.
- English only. JokeAPI serves other languages but this page does not request them.
- The Dark category is not offered here, and all six content flags are blacklisted, so a portion of the catalogue is unreachable from this page by design.
- Filtering depends on JokeAPI's own flagging. A miscategorized joke will pass through, and no automated filter is a substitute for judgement about audience.
- If the API is unreachable the page shows one stored joke, labeled as an offline fallback rather than presented as a fetch.
- No search, no favorites, no history and no way to request a specific joke.
Frequently Asked Questions
What joke categories are available?
Are jokes safe for work?
Are the jokes filtered?
Why do I keep seeing the same jokes?
Can I get jokes in another language?
Why is the punchline hidden?
What happens if the API is down?
Is the dark category available?
References & Further Reading
- JokeAPI v2 — documentation — Reference for the endpoint, the category list, the six content flags, safe-mode, and the single/twopart response types
- JokeAPI — /info endpoint — Source of the measured catalogue figures above: 1,368 total jokes and 183 English jokes passing safe-mode, on version 2.3.3