CSS Triangle Generator
Border Trick or Clip-Path

Pick a direction and copy the CSS. Make an isosceles, equilateral, right-angled or scalene triangle in eight directions, see the transparent-border trick and clip-path side by side, and attach it to a tooltip or speech bubble with the right ::after offsets. Tailwind classes included. 100% client-side. Zero data stored.

A glossy speech-bubble tooltip with a triangle arrow above three small neon triangles and the CSS lines border-left: 10px solid transparent; border-bottom: 10px solid #e67700;

CSS Triangle Generator Tool

Shape a Triangle

Direction

Up, down, left and right point that way. A corner button puts the right angle in that corner.

50%

0 or 100 gives a right-angled triangle; anything else off-center is scalene.

Transparent-border trick
  • Works in every browser, however old.
  • Cannot take a border, a gradient or an image of its own.
  • box-shadow follows the empty box, so use filter: drop-shadow.
  • Sized in pixels through the border widths.
CSS
 
Tailwind CSS
 
clip-path: polygon()
  • Can hold a gradient, an image or a video.
  • Sized as a box, so the percentages scale with it.
  • Cuts off its own shadow and border; put filter: drop-shadow on a wrapper.
  • Needs a current browser; very old ones ignore it.
CSS
 
Tailwind CSS
 

Previews are scaled down to fit when the triangle is larger than 220 px; the code always uses the real size. The apex of the border version is rounded to a whole pixel, the clip-path version uses the percentage.

Tooltip and Speech Bubble

The same triangle as a ::after arrow on a box. Its shape comes from the settings above, so turning the tooltip to another side never changes the arrow.

50%

The center of the arrow base sits at this share of the edge, kept between 10% and 90% so it stays on the box.

Tooltip text goes here

A rounded tip is not possible with the border trick or a polygon: both give a sharp point. For a soft tip, draw the arrow as an inline SVG path with stroke-linejoin round, or rotate a small rounded square by 45 degrees behind the box.

CSS (box and ::after rule)
 
Tailwind CSS
 

One class list for the box and its ::after arrow. Tailwind sets border-style to solid in its base layer, so the border technique relies on that layer, which is on by default.

Common Use Cases

Tooltips and Popovers

Attach a small arrow to a hint box on any side with the right ::after offsets, centered or moved along the edge.

Speech Bubbles and Chat

Give a message bubble a tail. Put the arrow on the left or right edge and slide it near the corner.

Dropdown Carets

Make a small pointing caret for a select, a menu or an accordion with no icon font and no image request.

Ribbons and Corner Folds

Use a right-angled corner triangle for a folded corner, a ribbon end or a diagonal cut on a card.

Breadcrumb and Step Arrows

Turn a step in a wizard or a breadcrumb into an arrow by adding a right-pointing triangle to its end.

Play Buttons and Markers

Draw a play icon, a sort arrow or a map marker tip in a single color that follows your theme variables.

Triangle CSS Reference

Border Trick: Which Border Is Colored

Direction Colored border Transparent borders
Upbottomleft and right
Downtopleft and right
Leftrighttop and bottom
Rightlefttop and bottom
Top left cornertopright
Top right cornertopleft
Bottom left cornerbottomright
Bottom right cornerbottomleft

The element has width 0 and height 0. The colored border is the depth of the triangle; the two transparent borders add up to its base, and moving the apex just trades width between them.

Border Trick or clip-path

Need Border trick clip-path
Oldest browsersYesNo
Gradient or image fillNoYes
Own border or outlineNoNo (cut off)
Shadow that follows the shapefilter on itselffilter on a wrapper
Scales with its boxNo (pixels)Yes (percentages)
Rounded tipNoNo

Both are pure CSS with no image and no script, and both are written from the same settings, so you can switch between them without redrawing anything.

Equilateral math

The depth is the base times 0.866 (half the square root of 3). The Equilateral lock rounds to whole pixels, so a 100 px base gives an 87 px depth.

Right-angled and scalene

Move the apex to 0 or 100 for a right angle on the base, use a corner direction for a right angle in a corner, or set any other apex for a scalene triangle.

Not a rounded tip

Neither technique can round the point. Use an SVG path with a round line join if you need a soft tip.

Related tools

Cut any polygon with the Clip Path Generator and add depth with the Box Shadow Generator.

Pro Tip: URL Parameters

Open the tool with a triangle already built. ?dir= is up, down, left, right, top-left, top-right, bottom-left or bottom-right; ?w= and ?h= are the size in pixels; ?a= is the apex position from 0 to 100; ?c= is a hex color without the hash and ?o= its opacity from 0 to 100; ?lock= is free, linked or equilateral; ?g=1 turns on the gradient with ?c2= as its second color; ?sh=1 adds the shadow. For the tooltip, ?side= is top, bottom, left or right, ?pos= is its position from 10 to 90 and ?tt= is border or clip. For example: /css-triangle-generator/?dir=down&w=24&lock=equilateral&c=0d9488

Bad values are ignored and sizes are kept between 1 and 500. The link in your address bar updates only after you change something, and the Copy Link button builds it from your current settings.

Frequently Asked Questions

Why We Built This CSS Triangle Generator

Tooltips, speech bubbles, carets and ribbons still need a triangle, and most of us still write it from memory: one colored border, two transparent ones, and a half-remembered rule about which is which. Get one side wrong and the arrow points the wrong way or floats off its box. We built a generator that writes the rule for all eight directions, keeps the apex and the sizes honest, and shows the result next to the clip-path version so you can choose with your eyes.

The two techniques are not interchangeable, so the page says plainly what each one can and cannot do: the border trick works everywhere but cannot hold a gradient, and clip-path can hold a gradient but cuts off its own shadow. The tooltip section writes the ::after rule with the right offsets for each side, and every output is in its shortest valid form, with a Tailwind version beside it. Everything runs in your browser, so nothing you design is uploaded.

The CSS Triangle Generator is part of RJL.io's collection of free developer tools. Cut any shape with the Clip Path Generator, add depth with the Box Shadow Generator, and build a fill with the Gradient Generator.

Is your site ready for Google and AI search?

The free SEO Analyzer checks any page in seconds - meta tags, structured data, AI crawler access - and tells you exactly how to fix each issue on your platform.