Odd parity bit calculator
For 1010, which has two ones, the odd-parity bit is 1, giving 10101 with three ones. Paste a string of zeros and ones to get the bit that makes the total count of ones odd, as a serial link set to odd parity expects. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Text
- 1010
- Length
- 4
- Ones
- 2
- Zeros
- 2
- Odd parity
- 1
Serial links, memory modules, and simple error-detecting codes still use a single odd-parity bit so the total number of ones in a word is odd. This odd-parity calculator accepts a binary string of zeros and ones, counts the ones, and returns 0 when that count is already odd or 1 when the count is even — the bit you append or check so the combined word has odd parity. Use it to mint UART frames, to verify RAID-style parity words, or to grade digital-design homework without a spreadsheet of XOR trees.
What odd parity means and how the extra bit is chosen
Odd parity is the rule that a data word plus one extra bit must contain an odd number of 1-bits. Even parity is the complementary convention where the total ones count is even; this tool implements only the odd convention, which serial standards such as RS-232 and UART often default to when a host asks for odd parity, eight data bits, and one stop bit.
Memory subsystems, RAID-4 style parity disks, and textbook Hamming codes all start from the same XOR-of-bits idea: the parity bit is the XOR of all data bits, then inverted for odd parity, or equivalently one minus the population count modulo two. Because XOR is associative and commutative, you can fold bits in any order and still get the same 0 or 1. This calculator does that fold on a binary string you already have, without packing bytes, without assuming seven- or eight-bit grouping, and without silently dropping spaces.
What you can do with it
UART and serial frame assembly
Build an 8-bit data word, compute the odd-parity bit, and append it before sending a frame that a UART configured for odd parity will accept.
FAQ
What is an odd parity bit?
It is a single extra bit chosen so that the data bits plus that bit contain an odd number of ones. If the data already has an odd ones-count the bit is 0; if the ones-count is even the bit is 1.
How does this calculator choose 0 or 1?
It counts the 1-bits (equivalently XORs every bit). When that count is even it returns 1; when the count is already odd it returns 0.
What happens if the input contains characters other than 0 and 1?
Spaces, letters, punctuation, and empty strings are not stripped or ignored, and failed validation is not billed.
Does odd parity detect every transmission error?
No. A single-bit parity scheme detects any odd number of flipped bits and misses any even number of flips. It does not correct errors and is not a cryptographic checksum.
What does the odd parity bit calculator cost?
The browser tool is free and runs locally.
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/enc/odd-parity \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"1010"}'const res = await fetch("https://api.kit.forhosting.com/enc/odd-parity", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "1010"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/enc/odd-parity",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "1010"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/enc/odd-parity", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"1010"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"1010"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/enc/odd-parity", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"text": "1010"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "enc.odd_parity",
"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.
Limits
max_chars | 100000 |
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
Characters other than 0 and 1 are rejected with invalid_input instead of being stripped in silence, so a mistyped letter cannot become a false checksum. The same deterministic parse logic runs free in the browser and at the published $0.002 API price, with no network, no clock, and no stored payload.
What odd parity means and how the extra bit is chosen
If the payload already has an odd count of ones, the extra bit is 0; if the payload has an even count, including zero ones, the extra bit is 1. That single bit does not correct errors, but it detects any odd number of bit flips: a single inverted bit changes the ones-count from odd to even, and a checker that recomputes odd parity will reject the frame.
Input contract, response shape, and error behaviour
A non-negative integer that stringifies to a binary digit string is also accepted, which helps numeric clients that send 1010 instead of quotes. An empty string is rejected for the same reason: there is no data bit to protect. Length is capped at the declared maximum so a runaway paste cannot stall the isolate. Failed validation is not billed. POST a JSON body with the required field text set to a non-empty string whose characters are only 0 and 1. Aliases input, value, binary, data, and bits are accepted and resolved in that order. Spaces, tabs, newlines, underscores, letters, punctuation, minus signs, and any other character fail with invalid_input naming the field, because silently stripping separators would hide a corrupted payload. On success the body echoes text, reports length, ones, and zeros, and returns odd_parity as the number 0 or 1. with_parity is the original string with that bit appended, and total_ones is ones plus the parity bit, which is always odd. scheme is always the token odd so downstream logs can record which convention was applied. Example: 1010 has two ones, which is even, so odd_parity is 1 and with_parity is 10101 with three ones. Example: 111 has three ones, already odd, so odd_parity is 0 and with_parity is 1110.
Where an odd-parity bit earns its keep in real systems
Data-quality jobs that receive binary dumps as text can reject rows whose characters are not 0 and 1 before any downstream parser assumes ASCII bits. UART and RS-232 adapters still expose a parity setting; firmware that builds an eight-bit data word plus an odd-parity bit can call this endpoint instead of maintaining a local XOR helper in every language of the stack. Digital-design courses ask students to compute the odd-parity bit of a vector by hand; an LMS can POST the same vector and mark the submitted 0 or 1 against a deterministic oracle that never invents a bit when the string contains a letter. Storage and RAID teaching labs that demonstrate a parity disk can recompute odd parity over a reconstructed bitstring after a simulated flip and show that total_ones is no longer odd. In every workflow the contract is the same: bits only, one 0 or 1 out, structured JSON you can snapshot in tests, identical behaviour free in the browser or via prepaid balance, and an honest failure when the input is not binary. Do not treat a matching odd-parity bit as proof that the payload is authentic or unmodified by an even number of flips — it only proves the ones count is odd under this scheme, the same honesty bar you apply to any single-bit checksum.
Integration use cases
Digital-design homework and LMS grading
Let students submit a binary vector and a guessed parity bit; compare against odd_parity from this oracle instead of a brittle spreadsheet of XOR trees.
Parity-checker unit tests
Mint with_parity for known vectors, flip one bit, and assert that a hardware or software checker now reports a parity error.