Election Result Generator

Fictional election results for civic tech demos

Generate fictional election results with candidate names, party labels, vote counts, and percentages that always sum to 100 percent. Useful for civic tech, voting apps, and political data visualization demos. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

Do the percentages always add to 100?

Yes. Votes are split as random integers that sum exactly to the total you enter, and percentages are computed from those counts then rounded so the displayed shares add to 100 percent. The leading remainder is assigned to the winner so rounding never breaks the total.

Civic-tech demos, election-night dashboards, and voting-app prototypes all need believable result data before any real count exists. This generator produces a fictional constituency result where the candidate vote shares always reconcile to 100 percent — the detail most ad-hoc random generators get wrong.

How it works

The tool splits the total valid votes into random integer chunks, one per candidate, guaranteeing the parts sum exactly to the total. Each candidate’s percentage is then computed and rounded, with any rounding remainder absorbed by the leading candidate so the displayed shares still total 100:

votes[i]   = random integer split, sum(votes) == total
pct[i]     = round(votes[i] / total * 100, 1)
winner     = candidate with max(votes)
margin     = winner.votes - runnerUp.votes

Candidates and parties come from neutral placeholder pools, so the output is entirely fictional and safe to publish.

Why the rounding problem matters

Independently rounding each candidate’s percentage to one decimal place almost always produces a sum that is not exactly 100 — you end up with 99.8% or 100.3%, which looks broken in a results table.

The correct fix is the “largest remainder method”: compute the true floating-point shares, take the floor of each, and distribute the remaining percentage points one at a time to the candidates with the largest fractional remainders. This generator uses that approach and assigns any final rounding adjustment to the winner, so the totals reconcile and the winner’s margin stays accurate.

Output format

The result is a JSON object structured for easy wiring into a results table or chart:

{
  "constituency": "North Riverside",
  "totalVotes": 48000,
  "winner": { "name": "A. Morris", "party": "Progressive Alliance", "votes": 18340, "pct": 38.2 },
  "candidates": [
    { "name": "A. Morris",  "party": "Progressive Alliance", "votes": 18340, "pct": 38.2 },
    { "name": "C. Bates",   "party": "Reform Party",         "votes": 14240, "pct": 29.7 },
    { "name": "D. Nguyen",  "party": "Green Coalition",      "votes": 10812, "pct": 22.5 },
    { "name": "E. Farooq",  "party": "Independent",          "votes": 4608,  "pct": 9.6  }
  ],
  "margin": 4100
}

The margin field is the raw vote gap between the winner and the runner-up — a natural input for a “majority of X votes” caption or a swing calculation field.

Testing scenarios to try

Close contest: set 2–3 candidates and a total in the low thousands. A race decided by a few hundred votes stress-tests margin-of-error displays and recount triggers.

Dominant winner: set 5+ candidates. With votes split many ways, the winner can take the seat on a low share — useful for demonstrating how plurality voting can produce unexpected results.

Large electorate: set a high total (for example 400,000). Verify your rounding and comma-formatting logic handles six-figure numbers gracefully.

Single candidate: the generator handles this edge case — useful for testing uncontested races or default state in your UI before real data arrives.

Because everything is entirely fictional, generated results are safe to use in public marketing screenshots, blog posts, and open-source demos.