Coefficient of relationship calculator
Full siblings share two pedigree paths of two links each, so their coefficient of relationship is 0.5, or 50%. List the paths through common ancestors, add inbreeding if any, and get Wright's r and the kinship coefficient. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
The coefficient of relationship, written r or Wright's r, is the expected fraction of alleles two individuals share identical by descent because pedigree paths connect them through common ancestors. Genetic counselors, livestock breeders, conservation geneticists, and students of quantitative genetics use that single number to compare a sketched pedigree with the textbook values for parent and child, full siblings, half siblings, grandparent and grandchild, uncle and niece, or first cousins. This coefficient of relationship calculator accepts every independent chain of generational links that joins the two people through a common ancestor, optional inbreeding of that ancestor, and optional inbreeding of the two focal individuals.
What Wright's r means and how generational links produce it
Sewall Wright defined the coefficient of relationship so that a pedigree becomes a probability rather than a drawing. Each independent path that joins two individuals through a common ancestor contributes one half raised to the number of generational links in that path, then multiplied by one plus the inbreeding coefficient of that ancestor. A parent and child share a single path of one link, so r equals one half.
Full siblings share two paths of two links, one through each parent, and those two contributions of one quarter add to one half. Half siblings share only one parent, so a single two-link path gives one quarter. First cousins share two four-link paths through a pair of grandparents and receive one eighth.
The kinship coefficient φ is half of r when neither focal person is inbred; it is the probability that a random allele drawn from one person is identical by descent to a random allele from the other. When either person is inbred the calculator uses the full identity r equals two φ over the square root of one plus F_X times one plus F_Y. Paths must be independent: do not count the same chain twice, and do not include loops that pass through the same person twice.
Identical twins are treated as a zero-link identity path with r equal to one, which is a definition rather than a long pedigree walk through more distant ancestors.
Who relies on a relationship coefficient calculator
Genetics classrooms use a coefficient of relationship calculator so students can convert a pedigree sketch into Wright's r without dropping a path or miscounting the links through a grandparent. Conservation pedigrees for captive breeding programs need a deterministic oracle that returns both kinship and relationship so mean kinship can be tracked without standing up a full graph library for a handful of paths. Failed validation does not consume balance.
Keep the path list short, pin relationship and kinship in tests, and you get reproducible Wright r figures for homework, mating memos, and edge workers without a pedigree database of your own.
What you can do with it
Classroom pedigree and quantitative-genetics homework
Let students list the independent generational-link paths on a pedigree and verify Wright's r, kinship φ, and the reduced fraction against textbook parent, sibling, and cousin values.
Livestock and companion-animal mating checks
Compare a proposed pairing by summing paths through shared ancestors, optionally raising F_A when a common ancestor is inbred, before a mating is booked.
Conservation pedigrees and counseling worksheets
Return deterministic kinship and relationship for captive-breeding or counseling forms without importing a full pedigree-graph library.
FAQ
What is the difference between kinship φ and relationship r?
Kinship φ is the probability that two random alleles, one from each person, are identical by descent. Wright's r is 2φ when neither person is inbred, and 2φ / √((1+F_X)(1+F_Y)) when they are.
What is the coefficient of relationship between full siblings?
One half. Full siblings share two paths of two links, one through each parent, and each path contributes one quarter, so together they reach 0.5.
What is the coefficient of relationship for first cousins?
One eighth. First cousins are joined by two paths of four links each through a shared pair of grandparents, and those two contributions add up to one eighth.
How do I count the links in a pedigree path?
Count each generational step from the first person up to the common ancestor and back down to the second person. A parent and child are one link apart; half siblings are two links apart through their shared parent.
What changes if the common ancestor is inbred?
That path's contribution is multiplied by one plus the ancestor's inbreeding coefficient, so an inbred ancestor makes the two relatives more closely related than the usual textbook value.
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/bio/coefficient-of-relationship \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"paths":[{"links":2,"ancestor_inbreeding":0},{"links":2,"ancestor_inbreeding":0}]}'const res = await fetch("https://api.kit.forhosting.com/bio/coefficient-of-relationship", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"paths": [
{
"links": 2,
"ancestor_inbreeding": 0
},
{
"links": 2,
"ancestor_inbreeding": 0
}
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/bio/coefficient-of-relationship",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"paths": [
{
"links": 2,
"ancestor_inbreeding": 0
},
{
"links": 2,
"ancestor_inbreeding": 0
}
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/bio/coefficient-of-relationship", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"paths":[{"links":2,"ancestor_inbreeding":0},{"links":2,"ancestor_inbreeding":0}]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"paths":[{"links":2,"ancestor_inbreeding":0},{"links":2,"ancestor_inbreeding":0}]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/bio/coefficient-of-relationship", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"paths": [
{
"links": 2,
"ancestor_inbreeding": 0
},
{
"links": 2,
"ancestor_inbreeding": 0
}
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "bio.coefficient_of_relationship",
"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_items | 50 |
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
Input contract, response shape, and validation rules
Each record needs links, a non-negative integer equal to the number of generational steps, or meioses, from the first person up to the common ancestor and back down to the second person. Every inbreeding value must be a finite number between zero and one inclusive. You may send at most fifty paths, and each links value may be at most forty so that powers of one half stay well inside ordinary floating-point precision. Example: two records with links equal to two and zero ancestor inbreeding describe outbred full siblings and return r equals 0.5, φ equals 0.25, and the fraction 1/2. POST a JSON body whose required field paths is a non-empty list of path records. An optional ancestor_inbreeding on that record is the ancestor's Wright inbreeding coefficient F_A and defaults to zero. Optional top-level inbreeding_a and inbreeding_b are the inbreeding coefficients of the two focal individuals and also default to zero. Missing paths, an empty list, a non-integer links value, a negative links value, an inbreeding value outside the unit interval, or a non-finite number fail with invalid_input naming the field and are not billed. On success the body echoes the normalized paths with each path's contribution to r, the two individual inbreeding values, kinship as φ, relationship as r, relationship_percent as one hundred times r, and, when every inbreeding coefficient is zero, relationship_fraction as a reduced dyadic string such as 1/2 or 1/8. A formula field restates Wright's identities and method is wright_path.
Where a coefficient of relationship API earns its keep
Livestock and companion-animal breeders compare proposed matings by reading r next to published bands for half siblings, uncle and niece, or first cousins, and they can raise ancestor_inbreeding when a common ancestor is already inbred. Counseling worksheets and LMS plugins benefit from a tiny parse endpoint that never invents IBD segments or microarray results when only the classical path method is required.
Technical questions
How do I calculate the coefficient of relationship from pedigree paths?
Send paths as records with links (generational steps through each common ancestor) and optional ancestor_inbreeding. Optional inbreeding_a and inbreeding_b are F_X and F_Y. The API returns r = 2φ / √((1+F_X)(1+F_Y)) with φ = Σ (1/2)^{L+1}(1+F_A).
How many links do common relatives use?
Parent–child is one path of 1 link (r=1/2). Full siblings are two paths of 2 links (r=1/2). Half siblings or grandparent–grandchild are one path of 2 links (r=1/4). First cousins are two paths of 4 links (r=1/8).
Can I include an inbred common ancestor?
Yes. Set ancestor_inbreeding on that path to the ancestor's Wright F_A in [0, 1]. The path contribution is multiplied by (1+F_A). Set inbreeding_a or inbreeding_b if a focal person is inbred.
What does the coefficient of relationship calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.