Tangent circle calculator
A circle of radius 3 seen from a point 5 away from its center has a tangent 4 long. Enter the radius and that distance and get the tangent segment, worked out as √(d² − r²). Points inside the circle are flagged. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Radius
- 3
- Distance
- 5
- Tangent length
- 4
- Tangent length squared
- 16
A tangent to a circle is a straight line that meets the circumference at exactly one point. When that line is drawn from a point that sits outside the circle, the useful number is not the infinite line but the finite segment from the external point to the contact point. That segment length is completely determined by two measurements you already have in most textbook and CAD problems: the circle radius and the distance from the center to the given point. This tangent-circle calculator applies the right-triangle identity that follows from the radius being perpendicular to the tangent at the point of contact. The tangent length equals the square root of the center distance squared minus the radius squared. Interior points are rejected because no real tangent exists when the distance is less than the radius.
How a tangent to a circle produces the length formula
Picture a circle with center O and a positive radius r. Pick a point P whose distance from O is d. If d is strictly greater than r, P lies outside the disk and you can draw two congruent tangent lines from P that each touch the circle at a single point.
Call one contact point T. The radius OT is perpendicular to the tangent line at T, a Euclidean fact that turns triangle OTP into a right triangle with the right angle at T. Pythagoras then says OT squared plus PT squared equals OP squared, which is r squared plus L squared equals d squared.
Solving for the unknown leg gives L equals the square root of d squared minus r squared. That single radical is the entire computation: no iterative root finding, no trigonometric tables, and no dependence on the angular position of P around the circle. Every point that shares the same radial distance d has the same tangent length.
When d equals r the point sits on the circumference and the formal radical collapses to zero, which this calculator reports as a zero-length tangent rather than inventing a contact geometry. When d is less than r the point is strictly inside the disk, the quantity under the square root would be negative, and no real tangent from P to the circle exists. Radius must be positive so the circle is non-degenerate.
Together these checks match the geometric hypotheses of the tangent theorem and keep client code free of silent imaginary results.
Where a tangent-circle calculator earns its keep
Classrooms and tutoring platforms use a tangent to a circle calculator so learners can check L equals square root of d squared minus r squared for arbitrary positive r and admissible d without arithmetic slips on the radical. Exam generators and LMS auto-graders need a deterministic oracle that marks interior points as invalid instead of inventing a length that a buggy grader might treat as a correct numeric answer.
Drafting notebooks and lightweight CAD helpers sometimes need the free length of a tangent from a known exterior point when only center distance and radius are available, before contact-point coordinates have been placed. Survey and robotics sketches that model circular obstacles use the same identity to decide how long a grazing path is from a known stand-off. Failed validation does not consume balance.
What you can do with it
Classroom and homework checks
Let students submit radius r and center distance d and verify L = √(d²−r²) against textbook Pythagorean checks for points on or outside the circle.
Drafting and obstacle sketches
Compute the grazing tangent segment from a known stand-off to a circular obstacle when only radius and center distance are available.
FAQ
How do I calculate the length of a tangent to a circle?
Send a positive finite radius r and a non-negative finite distance d with d ≥ r.
What happens if the point is inside the circle?
No real tangent from an interior point exists, and the failure is not billed.
What if the point lies on the circle (d = r)?
An interior point still requires d < r to be rejected.
Does the answer depend on the angle of the point around the circle?
No. Only the radial distance d and radius r matter. All points on the same concentric circle of radius d share the same tangent length.
How many tangents can be drawn from a point outside a circle?
Two, and both have exactly the same length, so one number answers for both. The calculator gives that length only; it does not work out where the lines touch the circle or which way they point.
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/tangent-circle \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"radius":3,"distance":5}'const res = await fetch("https://api.kit.forhosting.com/math/tangent-circle", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"radius": 3,
"distance": 5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/tangent-circle",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"radius": 3,
"distance": 5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/tangent-circle", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"radius":3,"distance":5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"radius":3,"distance":5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/tangent-circle", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"radius": 3,
"distance": 5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.tangent_circle",
"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
Input contract, response shape, and error behaviour
If distance is less than radius the point lies inside the circle and the task fails with a message that distance is less than the radius and that tangent length is not defined for an interior point. Classic textbook values work as expected: radius three and distance five yield tangent length four, because three-four-five is a Pythagorean triple with the radius and the tangent as legs and the center-to-point segment as the hypotenuse. A non-integer case such as radius two and distance five yields the square root of twenty-one. POST a JSON body with two required finite numbers: radius, the positive circle radius r, and distance, the non-negative distance d from the center to the given point. Each field may arrive as a JSON number or as a numeric string; missing fields, empty strings, and non-finite values fail with invalid_input naming the field. If radius is not strictly positive the request is rejected. If distance is negative the request is rejected. None of those validation failures consume prepaid balance. Pair the numeric result with your own diagram if you need a sketch of O, P, and T; this endpoint computes length only and does not emit coordinates of the contact points or the two possible tangent directions.
Where a tangent-circle calculator earns its keep
Keep requests small, pin the rounded tangent_length in tests, and you get reproducible lengths for homework, LMS plugins, and edge workers without standing up a computational-geometry engine of your own.
Integration use cases
Exam and LMS auto-grading
Mark tangent-to-a-circle items with a deterministic oracle that rejects interior points (d < r) as invalid_input instead of a fake length.
Technical questions
What does the tangent circle calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.