ForHosting KIT · Web Scraping & Monitoring

Generate a CSS linear or radial gradient

Pick linear or radial, set a direction or shape and list your color stops to get one CSS gradient ready to paste: 135deg with three stops at 0%, 45% and 100% becomes a linear-gradient() value. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon

Create a reusable CSS gradient without manually assembling punctuation or wondering whether each stop is in the right place. Choose a linear or radial gradient, provide its direction or shape, and add at least two ordered color stops. Each stop can contain a CSS color and an optional position. The result is a single deterministic gradient value ready for a background-image declaration, a design token, a stylesheet, or application code. Invalid types, descriptors, positions, and incomplete stop lists are rejected with clear input errors.

Choose the gradient family and its geometry

Begin with the visual behavior you need. A linear gradient moves along an axis, so its descriptor should be a CSS angle such as 135deg or a keyword direction such as to right, to bottom, or to top left. A radial gradient expands outward from a point.

Its descriptor can name circle or ellipse, optionally add a sizing keyword such as closest-side or farthest-corner, and optionally set an origin after at, for example circle at center or ellipse farthest-corner at 25% 40%. The generator checks the descriptor against the selected family instead of blindly joining arbitrary fragments. That catches mistakes such as supplying a radial shape to a linear gradient before the value reaches a stylesheet.

It also prevents commas and declaration-breaking characters from being hidden in the geometry. Choose linear when the transition should have a clear travel direction, and radial when the design should radiate from a focal point.

Build an ordered list of color stops

Add color stops in the exact order in which they should appear in CSS. Every stop requires a color, and the complete gradient requires at least two stops because a transition cannot exist with only one color. Colors may use familiar CSS forms such as named colors, hexadecimal values, rgb(), hsl(), or modern space-separated functional notation.

A stop position is optional. When omitted, the browser distributes unspecified stops according to CSS gradient rules. When included, it must be one or two CSS lengths or percentages, such as 0%, 12px, or 30% 45%.

Two positions create a hard color band using the same color at both boundaries. The generator preserves the order you provide; it does not sort positions or reinterpret the palette, because intentionally descending or overlapping stops can produce useful sharp transitions. Parentheses are checked for balance, and unsafe declaration characters are rejected.

This validation keeps the result predictable while leaving color selection and artistic intent under your control.

Use the generated value in CSS and automation

Assign that value to background-image, or to the background shorthand when no other background layers need to be preserved. You can also store it in a custom property such as --hero-gradient and reference the token across components. Because the capability performs only deterministic validation and string assembly, the same input always produces the same spacing and output.

That stability is useful for code generation, snapshot tests, theme builders, and content systems that compare generated values byte for byte. No network request, random choice, model inference, or clock value affects the result. When integrating the output, remember that this tool generates the gradient image value rather than a complete CSS rule: your application decides the selector, property, fallbacks, sizing, and any solid background color needed for older or constrained environments.

Create design tokens

Turn structured palette and geometry settings into stable gradient values for a shared theme or component library.

Power a visual style editor

Convert form controls for type, direction, shape, colors, and stop positions into CSS ready for a live preview.

Generate stylesheet values in a build

Produce consistent gradient strings from configuration files without maintaining custom joining and validation logic.

Can a color stop omit its position?

Yes. Browsers automatically place unspecified stops according to the CSS gradient rules.

Which linear directions are supported?

Use an angle with deg, grad, rad, or turn, or a keyword direction such as to right, to bottom, or to top left.

Can I move the center of a radial gradient?

Yes. Add an at position to the radial descriptor, such as circle at center or ellipse at 20% 40%.

How do I make a hard color band instead of a smooth blend?

Give a stop two positions, such as 30% 45%. The same color then fills that whole stretch and forms a sharp band. Overlapping or descending positions also create sharp transitions, and your order is kept exactly as entered.

Where do I use the generated gradient?

Assign it to background-image, or to the background shorthand when no other background layers need to be kept. It also works as a reusable design value or straight in a stylesheet.

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.

POSThttps://api.kit.forhosting.com/web/css-gradient-generate

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.

curl -X POST https://api.kit.forhosting.com/web/css-gradient-generate \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"gradient_type":"linear","direction_or_shape":"to right","color_stops":[{"color":"#2563eb","position":"0%"},{"color":"#7c3aed","position":"100%"}]}'
{
  "gradient_type": "linear",
  "direction_or_shape": "to right",
  "color_stops": [
    {
      "color": "#2563eb",
      "position": "0%"
    },
    {
      "color": "#7c3aed",
      "position": "100%"
    }
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "web.css_gradient_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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

timeout_sec30
max_crawl_pages25
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Choose the gradient family and its geometry

Keeping geometry separate from colors makes the request easy to review and reuse.

Use the generated value in CSS and automation

The response contains a gradient field whose value starts with linear-gradient() or radial-gradient().

How many color stops are required?

At least two color stops are required. A request with fewer stops fails with an invalid_input error.

What does it cost?

The API price is $0.002 per request. The on-page browser runner is free.

Read the full KIT documentation →