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 →CSS Box Shadow: A Complete Guide with Examples (2026)
Master CSS box-shadow: every value explained, layering multiple shadows for realistic depth, inset shadows, the spread trick, and copy-paste examples for cards, buttons, and more.
How to Create Glassmorphism in CSS: The Complete 2026 Guide
Learn how to build the frosted-glass effect with CSS backdrop-filter. Real code, the accessibility traps nobody mentions, browser support, and performance tips from production.
The Complete Guide to CSS Gradients (2026)
Master linear, radial, and conic CSS gradients. Learn color stops, angles, hard stops for stripes, multi-layer gradients, and the tricks behind smooth, professional results.