CSS Triangle Generator
Create CSS triangles visually with a live preview. Pick a direction, size, and color, switch between the border-trick and clip-path methods, and copy ready-to-use CSS.
No More Guessing Border Widths
Triangles show up everywhere in interfaces: dropdown carets, tooltip arrows, ribbon corners, and decorative shapes. Instead of hand-calculating border widths or clip-path points, pick a direction and drag a few sliders until the preview looks right.
Why Use This Generator?
Two Proven Methods
Switch between the classic border trick, which works in every browser, and clip-path, which supports gradients and smooth shape animations.
Instant Live Preview
Every slider and color change updates the triangle immediately, so you can match a design file or spot an issue before copying anything.
Clean, Ready-to-Use CSS
The output is a single, correctly formatted CSS rule with no extra markup, ready to paste into a stylesheet, styled-component, or CSS module.
Works On Any Device
The layout and controls are built for touch and small screens, so you can fine-tune a triangle just as easily on a phone as on a desktop.
How this CSS Triangle Generator works
Two techniques dominate CSS triangle creation, and they solve different problems. The border trick sets an element's width and height to zero, then relies on thick, mismatched borders meeting at sharp angles to fake a triangle shape. It has worked since Internet Explorer 6 and needs no special browser support, but it only produces a flat, single-color shape. Clip-path takes the opposite approach: it cuts a triangular window out of a normal box, so the shape can carry a gradient, a background image, or animate smoothly into another polygon. This generator builds both versions from the same controls, so you can compare them side by side.
Pick one of eight directions: the four cardinal points for symmetrical triangles, or the four corners for right-angled shapes suited to ribbon corners and folded-edge effects. Drag the width and height sliders to reshape the triangle, and set a color with the picker or by typing a hex value. The preview updates on every change, rendered with the exact CSS the tool hands you, not an approximation.
Switch the background behind the preview to check how the shape reads on light, gray, or dark surfaces before committing to a color. Once it looks right, copy the CSS block below the preview: a border-trick rule if you chose that method, or a width, height, background-color, and clip-path declaration if you picked the other. Nothing you build here is uploaded or stored; the code stays in your browser until you copy it out.
How to use this CSS Triangle Generator
Pick a direction and method
Choose which way the triangle should point and whether you want the classic border trick or a clip-path shape.
Adjust size and color
Drag the width and height sliders and set a color. The preview updates instantly so you can match your design.
Copy the CSS
Copy the generated code and paste it directly into your stylesheet or component.
Example Usage
A classic upward-pointing triangle using the border trick:
Frequently Asked Questions
What is the difference between the border trick and clip-path for CSS triangles?
Which method should I use for a tooltip or dropdown arrow?
Can I animate a CSS triangle?
Why does my triangle look like a square or a rectangle?
How do I make an equilateral triangle instead of a right-angled one?
Can I add a border outline around the triangle shape itself?
Does the border-trick method work in older browsers?
Can I rotate the triangle to point in a direction that is not listed?
Why is the triangle blurry when I make it very large?
Does this tool store or upload the triangles I create?
Related Tools
CSS Formatter
Format CSS code for better readability.
CSS Beautifier
Beautify and format CSS code for better readability and structure.
Random Color Generator
Generate a random color
Gradient Generator
Generate the gradient using two colors
CSS Box-Shadow Generator
Design custom CSS box shadows with a live preview. Adjust offset, blur, spread, and color, stack multiple layers, and copy the code.
CSS Loader Generator
Build CSS loading spinners with a live preview. Pick a style, adjust size, color, and speed, then copy ready-to-use CSS and HTML.
The CSS Triangle Generator is maintained by CodeItBro. We aim to provide the best free developer tools on the web. If you have feedback or suggestions, please visit our contact page.

