Generate a CSS border-radius value
The CSS border-radius generator turns one, two, three, or four corner radius values into a ready-to-use shorthand declaration.
Run — free
Enter ordinary CSS lengths or percentages, and it returns both the shorthand value and the complete border-radius property. The order follows the CSS specification, so you can style every corner consistently without mentally reconstructing which position controls which corner. Negative radii are rejected because they are not valid border-radius values in production stylesheets.
Choose one to four radius values
Start with the number of values that matches the shape you want. One value applies the same radius to all four corners, which is ideal for cards, buttons, inputs, and other symmetrical components. Two values alternate across opposite corners: the first controls the top-left and bottom-right corners, while the second controls the top-right and bottom-left corners. Three values use the first for top-left, the second for both top-right and bottom-left, and the third for bottom-right. Four values provide independent control in clockwise order: top-left, top-right, bottom-right, then bottom-left. Each entry must be a nonnegative CSS length or percentage, such as 8px, 0.5rem, 12%, or 0. Unitless zero is accepted because CSS permits it, but other nonzero numbers need a recognized length unit or a percent sign. Keeping the input as separate values makes the intended corner mapping visible before the final shorthand is assembled.
Read and use the generated CSS
The result includes two fields for different workflows. The border_radius field contains only the shorthand value, making it convenient when an application already knows which CSS property it is setting or when a design-token pipeline needs a clean value. The css field contains the complete declaration, including the border-radius property name, colon, and semicolon, so it can be pasted directly into a style rule. Values are emitted in the same order you supplied them, with a single space between tokens. The generator does not silently reorder corners, convert units, or collapse repeated values, because preserving the supplied representation makes the output predictable and avoids changing intentional design-token syntax. For example, supplying 8px and 16px produces border-radius: 8px 16px;, while four values produce a clockwise declaration. The output is deterministic and contains no browser-dependent measurement, so the API and in-browser tool return the same strings.
Validate radii before shipping a component
CSS corner radii cannot be negative, so this generator stops with an input error whenever a value begins with a minus sign. It also rejects empty entries, unsupported text, bare nonzero numbers, declarations containing punctuation, and arrays outside the one-to-four-value range. That validation is useful when radius choices come from a form, a configuration file, a theme editor, or an automated design-token build where malformed text might otherwise reach a stylesheet unnoticed. Accepted values cover common absolute, font-relative, viewport-relative, container-independent physical, and percentage units, including px, em, rem, vw, vh, vmin, vmax, ch, cm, mm, in, pt, and pc, along with modern viewport variants. This capability generates the standard single-radius shorthand; it does not create the slash-separated elliptical syntax. If you need elliptical corners, keep horizontal and vertical radii separate in your own CSS. Use the returned declaration as a validated building block, then preview it on the actual element because percentages depend on that element's dimensions.
What you can do with it
Build component styles
Create a paste-ready border-radius declaration for cards, buttons, dialogs, badges, and form controls.
Validate design tokens
Reject negative or malformed radius tokens before a theme or component library publishes its generated stylesheet.
Generate dynamic CSS
Turn radius choices from a visual editor or configuration form into predictable CSS shorthand.
FAQ
What does it cost?
It costs $0.002 per API request and can also run free in your browser on this page.
What order do four values use?
They follow CSS clockwise order: top-left, top-right, bottom-right, then bottom-left.
Can I use percentages?
Yes. Nonnegative percentage values such as 10% or 50% are accepted alongside supported CSS length units.
Why are negative values rejected?
The CSS border-radius property does not allow negative radii, so rejecting them prevents an invalid declaration.
Is unitless zero allowed?
Yes. Zero and decimal forms equal to zero are accepted without a unit; nonzero values require a supported unit or percent sign.
Does it generate elliptical radii with a slash?
No. It generates the standard one-to-four-value shorthand for equal horizontal and vertical radii at each corner.
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/web/border-radius-generate \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"values":["8px","16px","24px","32px"]}'const res = await fetch("https://api.kit.forhosting.com/web/border-radius-generate", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"values": [
"8px",
"16px",
"24px",
"32px"
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/web/border-radius-generate",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"values": [
"8px",
"16px",
"24px",
"32px"
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/web/border-radius-generate", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"values":["8px","16px","24px","32px"]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"values":["8px","16px","24px","32px"]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/web/border-radius-generate", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"values": [
"8px",
"16px",
"24px",
"32px"
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "web.border_radius_generate",
"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
timeout_sec | 30 |
max_crawl_pages | 25 |
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. |