Interval notation converter
A lower bound of -2 that is included and an upper bound of 5 that is not give [-2, 5): every number from minus two up to, but not including, five. Enter both bounds, say which ones count, and get the interval. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Lower
- -2
- Upper
- 5
- Interval
- [-2, 5)
bounds and inclusivity to interval form
What interval notation is
Interval notation is the compact standard way of writing a set of real numbers between two bounds. A square bracket means the bound is included in the set; a parenthesis means it is excluded. So [-2, 5) reads as every number from minus two up to but not including five.
Students meet it as soon as they solve a linear inequality, and it follows them through precalculus, calculus and beyond. The four combinations of the two flags cover every bounded case: closed-closed, closed-open, open-closed and open-open, and each maps to exactly one bracket pair, so there is never any ambiguity about what the output should look like for a given input.
How the conversion works
You send a lower bound, an upper bound and two booleans. The converter first validates that both bounds are finite numbers, then checks that the lower bound does not exceed the upper bound — a reversed pair is rejected with an invalid input error instead of producing a meaningless string.
Equal bounds are allowed when both are inclusive, which yields a degenerate interval such as [3, 3] containing exactly one point; equal bounds with an exclusive side describe the empty set and are rejected, because there is no honest bracket string for it. The output mirrors the input back alongside the formatted interval, so a caller can log exactly which flags produced which string.
Where it fits in a pipeline
Most callers do not write bounds by hand; the flags come out of an inequality solver, a constraint checker or an optimization step, and this converter sits at the end of that chain as the formatting layer. Typical uses are rendering a solution set on a homework platform, generating expected answers for an automated grader, normalizing results from several solvers into one canonical string before comparing them, and building readable constraint reports.
Because the output is deterministic and byte-stable, it is also a natural fit for snapshot testing: a test suite can assert on the exact interval string rather than on a regular expression, and a change in any upstream flag shows up immediately as a diff. If you need the previous step — solving the inequality itself — pair it with the linear inequality solver capability in the same catalog, which produces exactly the bounds and flags this converter expects.
What you can do with it
Render a solved inequality
Turn the bounds and inclusivity flags from a linear inequality solver into the standard interval string for display.
Normalize constraint reports
Format ranges from different validation steps into one canonical notation before comparing or archiving them.
FAQ
What do the brackets mean?
A square bracket [ or ] means the bound is included; a parenthesis ( or ) means it is excluded. For example, [-2, 5) includes -2 but not 5.
What happens if the lower bound is greater than the upper bound?
A reversed pair of bounds does not describe a real interval.
Can the two bounds be equal?
Yes, but only when both are inclusive, producing a single-point interval like [3, 3]. Equal bounds with an exclusive side describe the empty set and are rejected.
Are my numbers stored anywhere?
No. The input is processed and discarded; only the interval string and the echoed bounds are returned.
Does it handle decimals and negative numbers?
Yes. Any finite number is accepted, and integers are rendered without a decimal point so the output is stable.
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/interval-notation \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"lower":-2,"upper":5}'const res = await fetch("https://api.kit.forhosting.com/math/interval-notation", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"lower": -2,
"upper": 5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/interval-notation",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"lower": -2,
"upper": 5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/interval-notation", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"lower":-2,"upper":5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"lower":-2,"upper":5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/interval-notation", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"lower": -2,
"upper": 5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.interval_notation",
"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
The interval notation API takes the two bounds of a solution set — a lower bound, an upper bound and a flag for each saying whether that bound is included — and returns the standard interval notation string, such as [-2, 5) or (0, 10]. It is the last step of every solved linear inequality, done consistently in one call, with a clear error when the lower bound exceeds the upper bound.
Where it fits in a pipeline
It runs on our global edge with nothing stored afterwards, and the same deterministic code runs free in your browser on this page, so you can verify a conversion interactively and only pay — $0.002 per request — when you automate it at volume.
Integration use cases
Generate grader fixtures
Produce the exact expected interval notation for an automated math grader, byte-stable across machines.
Technical questions
What does it cost?
$0.002 per request via the API. It is also free to run in your browser on this page.