Skip to main content
WizTools123
WizTools123
Free Online Tools

Tool Categories


Developer Tools New Tool

Free Online CSS Shape Generator, Triangles, Arrows and Bubbles

Build a shape out of one element and copy the CSS, including the pseudo-element where one is needed. Border triangles and arrows in any direction, circles, ovals, pills and squircles, speech bubbles with a tail you can place, and simple stars, all previewed as the real shape.

Free Forever Nothing Uploaded Nine shapes from one element Runs in your browser
Free Online CSS Shape Generator, Triangles, Arrows and Bubbles
Share this tool
Advertisement Slot (Top Banner) Google AdSense Unit • Responsive Banner
CSS Shape Generator Everything happens in this tab. Nothing you paste is sent anywhere.
Preview

CSS
Shape
Size 120px 90px 14px
Tail 16px 24%
Output
Buy Us A Coffee

Enjoying WizTools123? Help keep our server infrastructure 100% free and open for everyone.

Buy Us A Coffee
Sponsored Content (Below Tool) Google AdSense Placement

Why a triangle made of borders works

The corners of a border are mitred, and that diagonal is the shape.

Give an element four thick borders in four different colours and you get four trapeziums, not four rectangles. That is because adjacent borders meet on a diagonal: the browser mitres the join, exactly as a picture frame is cut at 45 degrees, so the boundary between the top border and the left border runs corner to corner.

Now shrink the element's content box to nothing with width: 0; height: 0. The four trapeziums lose their short parallel edge and become four triangles meeting at the centre. Make three of them transparent and leave one coloured, and a single triangle is all that remains:

.triangle-up{
	width: 0;
	height: 0;
	border-left: 60px solid transparent;
	border-right: 60px solid transparent;
	border-bottom: 90px solid #7c3aed;   /* the visible one */
}

The two transparent side borders set the base width, half each, and the coloured border sets the height. The triangle points away from the coloured border, which is why a triangle pointing up is made with border-bottom. That reversal is the single most confusing thing about the trick, and it is the reason this page asks which way the shape should point rather than which border to colour.

How to Make a Shape in Pure CSS

A few steps, and nothing is uploaded.

1
Pick a shape Border triangles and arrows, round shapes from border-radius, a speech bubble with a pseudo-element tail, or a simple star. The controls change to suit whatever you choose.
2
Set the size and colour Width and height are in pixels. For a border triangle the width is the base and the height is how far it reaches, and the tool splits the base across the two transparent borders for you.
3
Place the tail, if there is one The speech bubble tail is a second triangle drawn as a pseudo-element. Choose the side, the size and how far along that side it sits.
4
Copy the whole block The output is a complete rule, including the ::before or ::after block where the shape needs one. Change the class name first if you want it to match your stylesheet.

What to Know About CSS Shapes

Including why a triangle made of borders works at all.

A border triangle works because adjacent borders meet on a diagonal. The browser mitres border corners the way a picture frame is cut, so each border is a trapezium, not a rectangle. Collapse the content box to zero width and height and those trapeziums become four triangles meeting in the middle. Colour one and make the rest transparent and you have a single triangle, pointing away from the coloured side. The section above shows the arithmetic.
clip-path is the better answer once the shape has more than three sides. The border trick only makes triangles and right angles, it cannot take a border or a shadow of its own, and it cannot be scaled in per cent. A polygon in clip-path handles stars, hexagons, chevrons and anything asymmetric, accepts percentage coordinates so it can be responsive, and is far easier to read six months later. Use borders for small fixed tooltip tails and clip-path for everything larger.
Some of these shapes need a pseudo-element, and that has consequences. The speech bubble tail and the arrow stem are drawn with ::before or ::after, which means the element must not be a replaced element such as an img or an input, because those cannot have generated content. It also means the shape is two painted pieces, so a shadow applied to the box will not follow the tail.
This page makes one shape at a time and does not read CSS back. There are nine shapes, not an arbitrary shape editor: no custom polygons, no blobs, no hearts, no gradients on the shape, and no way to paste an existing rule in and have the controls match it. Stars are made with clip-path rather than the old five-triangle trick, so they cannot take a border either.

Key Features & Capabilities

What this tool does, and what it deliberately does not.

The border trick, set up Triangles and right angles in four directions, with the borders worked out.
Round shapes Circle, oval, pill and squircle, all from border-radius alone.
Pseudo-elements shown Where the shape needs a ::before or ::after, the block is in the output.
Tail you can place A bubble tail on any side, at any position along it, at any size.
The real shape The preview applies the generated CSS to a real element, over a checker board.
Runs in your browser No image, no SVG file, nothing fetched. Works offline.

About the CSS Shape Generator

Every shape on this page is one HTML element with no image and no SVG behind it. Some of them are obvious once you know the rule, like a circle from border-radius: 50%. Others are older tricks that survive because they are still the shortest way to get the job done: a triangle built entirely out of borders is four lines of CSS and needs no extra markup, which is why every tooltip tail on the web is made that way.

The hard part of a generator for this is not the arithmetic but the preview. A speech bubble tail and an arrow stem are pseudo-elements, and you cannot set a pseudo-element from an inline style, so the page writes its generated CSS into a real <style> element on the page and lets the browser apply it. That means the preview is the actual shape produced by the actual rule, including the ::after, rather than a drawing that approximates it.

The output is the whole block, pseudo-element included, with a class name you can set. Where a shape is better done another way the page says so rather than pretending otherwise: stars are made with clip-path, not with stacked triangles, and the notes are explicit about when to abandon the border trick entirely. The shapes are a fixed set of nine; this is not a freeform shape editor, and the clip-path generator is the tool for that.

Frequently Asked Questions

Borders, pseudo-elements, clip-path and when to use an SVG.

Because the visible border is the one opposite the point. The two transparent left and right borders form the base, and the coloured bottom border fills the wedge that rises from that base, so the tip ends up at the top. It reads backwards the first few times. This page asks which way the shape should point and picks the border for you, so you never have to hold that inversion in your head.

Not directly. The triangle is already made of borders, so there is nothing left to add one to, and a box-shadow follows the rectangular border box rather than the visible wedge. For an outlined triangle, stack a slightly larger triangle in the outline colour behind a smaller one. For a shadow, use filter: drop-shadow() on the element, since a filter follows the painted pixels.

As soon as the shape has more than three sides, needs to be responsive, or is asymmetric. clip-path: polygon() takes percentage coordinates so the shape can scale with its container, and it reads as a list of corners rather than as a puzzle. Borders remain the better choice for small fixed tooltip and dropdown tails, where the shape is a few pixels and never changes size.

The most likely reason is that the element cannot have generated content. An img, an input and other replaced elements have no ::before or ::after, so use a div or a span. The other common cause is overflow: hidden on the bubble or an ancestor, which crops the tail because the tail sits outside the box.

For small decorative pieces, usually yes: no extra request, no extra markup, and the colour can come from a custom property. For anything with a curve that is not an ellipse, several colours, or a shape that must be identical across browsers, an inline SVG is simpler, more accurate and easier to maintain. Pure CSS shapes are a good tool with a clear ceiling.

Other Developer Tools

Advertisement Slot (Bottom Banner) Google AdSense Unit • Responsive Banner