What is the CSS Border Image Generator?
Generate border-image CSS for gradient and image borders. Set slice, width, outset, and repeat. Preview on any element size.
Everything runs locally in your browser. Adjust the controls above, preview instantly, and copy clean, production-ready CSS — no account, no upload.
Using the CSS Border Image Generator
Everything lives in the panel at the top of this page. There is nothing to install — it all runs right here in your browser.
Set the border-image-source
Enter a gradient or image URL as the border image source. Gradients are the most common use case.
Set slice, width, and outset
border-image-slice: 1 is correct for gradients. Set border-width to control thickness. Outset extends the border outside the element box.
Copy the CSS
Click Copy to get the border-image shorthand or individual sub-properties.
What the generated code looks like
Clean, production-ready CSS — no vendor bloat, no unnecessary declarations.
/* Gradient border using border-image */
.gradient-border {
border: 3px solid transparent;
border-image: linear-gradient(135deg, #6C2EF5, #f97316) 1;
}
/* Thicker gradient border */
.thick-border {
border-width: 4px;
border-style: solid;
border-image-source: linear-gradient(90deg, #6C2EF5, #f97316);
border-image-slice: 1;
}border-image does not support border-radius. For rounded gradient borders, use the pseudo-element technique instead.
Pro tips for better results
border-image does not support border-radius
This is the most common gotcha. border-image and border-radius are incompatible. For rounded gradient borders, use background-clip or a pseudo-element background instead.
Use border-image-slice: 1 for gradient borders
When using a linear or radial gradient as the border image, border-image-slice: 1 stretches the gradient across the entire border. This is almost always the correct value for gradient borders.
border must have a non-transparent style for border-image to show
Set border: 3px solid transparent before applying border-image. The border-image replaces the solid colour, but the border must have a non-zero width and a style (solid, dashed, etc.).
Frequently asked questions
From the blog
Read more →Modern CSS techniques every developer should know
A practical tour of the CSS features that replaced yesterday’s hacks.
From design to code without the friction
How visual generators speed up the build without sacrificing clean output.
Writing CSS that scales with your project
Tokens, naming, and structure that keep large stylesheets maintainable.