Sainte-Laguë seat allocation calculator free
With 5000, 3000 and 2000 votes and 5 seats to fill, the Sainte-Laguë method gives the three parties 3, 1 and 1 seats. Enter each party's votes and the number of seats, and see who wins every seat and with what quotient. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Allocates parliamentary seats by the Sainte-Laguë (Webster) highest averages method with optional modified first divisor. Free, deterministic, and private in your browser. No account required.
How the Sainte-Laguë method shares out seats
Sainte-Laguë, also known as the Webster method, is a highest averages method: seats are handed out one at a time, and each goes to the party with the highest quotient at that moment. A party's quotient is its votes divided by twice the seats it already holds plus one, so the divisors run 1, 3, 5, 7 and so on. With 5000, 3000 and 2000 votes and 5 seats, the first three seats go to A, B and C on their full totals; A then wins the fourth with 5000 divided by 3 and the fifth with a quotient of 1000. The result is 3, 1 and 1.
The modified version and common slips
The modified variant divides each party's votes by 1.4 instead of 1 for its first seat, which makes that seat harder to win; the following divisors stay the same. When working it out by hand, the most frequent mistake is dividing by 2, 3 and 4 instead of 3, 5 and 7 after a party wins, which turns the count into a different method. Another is forgetting to recalculate the winner's quotient after every seat. The calculator lists every seat with its winner and quotient, so each step can be checked.
What you can do with it
Homework and exams
Check classic quantitative problems quickly with stable, reproducible answers.
Automation
Call the same pure function from scripts without installing a spreadsheet or CAS.
FAQ
Is this free?
Yes. Tier A runs entirely in your browser without an account.
What is the modified Sainte-Laguë method?
It is the same method with one change: a party's first seat is calculated by dividing its votes by 1.4 instead of 1. That makes the first seat harder to win, while every later divisor stays 3, 5, 7 and so on.
How is each party's quotient worked out?
Divide the party's votes by twice the number of seats it already holds, plus one. A party with no seats yet divides by 1, after one seat by 3, after two by 5, and the highest quotient takes the next seat.
Can I see how each seat was decided?
Yes. Besides the final share-out, the calculator lists every seat in order with the party that won it and the quotient it won with, so a homework answer or a published result can be checked step by step.
Can I give the parties their own names?
Yes. You can add one name per party, in the same order as the votes, and the results then show every party by name with its votes and the seats it won.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/math/sainte-lague \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"votes":[5000,3000,2000],"seats":5}'const res = await fetch("https://api.kit.forhosting.com/math/sainte-lague", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"votes": [
5000,
3000,
2000
],
"seats": 5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/sainte-lague",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"votes": [
5000,
3000,
2000
],
"seats": 5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/sainte-lague", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"votes":[5000,3000,2000],"seats":5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"votes":[5000,3000,2000],"seats":5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/sainte-lague", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"votes": [
5000,
3000,
2000
],
"seats": 5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.sainte_lague",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
How it works
Each seat is awarded to the party with the highest votes/(2s+1) quotient (or 1.4 for the first seat when modified). The implementation is fully deterministic and runs free in the browser with the same pure function as the API path. Inputs are validated before any arithmetic so wrong types and out-of-range values become clear invalid_input errors instead of silent NaN results. The implementation is fully deterministic and runs free in the browser with the same pure function as the API path. Inputs are validated before any arithmetic so wrong types and out-of-range values become clear invalid_input errors instead of silent NaN results.
Inputs and outputs
Required fields must be present and correctly typed. Optional fields use documented defaults. Error messages use stable English match substrings for the harness. Allocates parliamentary seats by the Sainte-Laguë (Webster) highest averages method with optional modified first divisor. Provide the fields listed in the input schema. The success payload always includes the primary result fields named in the output schema so clients can bind UI metrics without guessing. The implementation is fully deterministic and runs free in the browser with the same pure function as the API path. Inputs are validated before any arithmetic so wrong types and out-of-range values become clear invalid_input errors instead of silent NaN results. The implementation is fully deterministic and runs free in the browser with the same pure function as the API path. Inputs are validated before any arithmetic so wrong types and out-of-range values become clear invalid_input errors instead of silent NaN results.
Edge cases and limits
Requires at least two parties and a positive integer seat count. Empty or contradictory ranges are rejected early. Extremely large intermediate values that overflow IEEE-754 become an out-of-range error rather than null fields. The implementation is fully deterministic and runs free in the browser with the same pure function as the API path. Inputs are validated before any arithmetic so wrong types and out-of-range values become clear invalid_input errors instead of silent NaN results. The implementation is fully deterministic and runs free in the browser with the same pure function as the API path. Inputs are validated before any arithmetic so wrong types and out-of-range values become clear invalid_input errors instead of silent NaN results.
Integration use cases
Teaching demos
Show worked examples with golden fixtures that match the free widget and the API.
Technical questions
Does it call the network?
No. The parse engine keeps everything on-device.
What if my input is invalid?
You receive invalid_input with a clear English message.
Are results stable?
Yes. Deterministic math and golden examples freeze the contract.
Who authors this capacity?
samurai on the ForHosting KIT workshop.