I want to draw some round-ended rectangles to use as labels, so I thought a filled arc either end would work (silly me :-)

\draw [fill](0,0) arc[radius=5pt,start angle= 90,end angle=270];
\draw [fill](0,0) rectangle (40,-20);
\draw [fill](40,0) arc[radius=5pt,start angle=270,end angle=90];

But this places the right-hand end-cap above the rectangle, and facing the wrong way. I have obviously misunderstood the implications of the direction angles.

How do I draw a filled arc that points right, not left? (that is, D-shaped, the mirror of the first one).

  • If you load the shapes.misc TiKZ library, you can use the shape rounded rectangle which does exactly what I think you want.
    – cfr
    Commented Nov 9, 2014 at 20:31
  • I think you want a start angle of 90 and an end angle of -90 (because you want the curve to go in the opposite direction).
    – cfr
    Commented Nov 9, 2014 at 20:41

5 Answers 5


If people come to this question via Google (like me) and want to get only a rectangle with rounded corners:

\draw[rounded corners] (0, 0) rectangle (4, 1) {};

This is an empty rectangle with rounded corners. The rectangle is from (0, 0) - the lower left corner - to (4, 1) - the upper right corner.

  • 1
    +1 Exactly what I needed. Thanks
    – Joseph R.
    Commented Feb 7, 2019 at 15:58
  • 3
    Also works with \node[rectangle, rounded corners] Commented Apr 2, 2020 at 19:59
  • 3
    Worth noting you can use an argument for the radius of the corners: \draw[rounded corners=1cm] (0, 0) rectangle (4, 1) {}; (surprisingly, by default the unit appears to be pt rather than cm).
    – varkor
    Commented Sep 7, 2022 at 14:54
  • 1
    I'm using overleaf and when I try this (or any other solutions), I keep getting the error "Package pgfkeys Error: I do not know the key '/tikz/roundedcorners' and I am going to ignore it." Any idea why that is?
    – mapf
    Commented Nov 23, 2022 at 18:09
  • Worth checking whether shapes is in your \usetikzlibrary directive, eg \usetikzlibrary{svg.path,positioning,shapes,calc,arrows.meta}
    – Adam Burke
    Commented May 9, 2023 at 6:53

This shows how to adjust the angles in your original commands (I've scaled the rectangle down just so the labels show up better) and then demonstrates the use of rounded rectangle from the shapes.misc library.

\usetikzlibrary{shapes.misc, positioning}
    \draw (0,0) arc[radius=5pt,start angle= 90,end angle=270];
    \draw (0,0) rectangle (40pt,-20pt);
    \draw (40pt,0) arc[radius=5pt,start angle=90,end angle=-90];
    \node (1) [draw, rounded rectangle] {rounded rectangle};
    \node (2) [below=of 1, draw, rounded rectangle, rounded rectangle west arc=0pt] {rounded rectangle};
    \node (3) [below=of 2, draw, rounded rectangle, rounded rectangle east arc=0pt] {rounded rectangle};

rounded rectangles - multiple ways

  • Thank you...I didn't even check the documentation for that because I thought it was too unlikely a shape to have been considered! Commented Nov 9, 2014 at 20:44
  • 1
    @PeterFlynn There are some weird and wonderful shapes in the shapes library. Who would have thought that there would be specific shapes for magnetic tape and chamfered rectangle shapes, for example?
    – cfr
    Commented Nov 9, 2014 at 20:48

Why not using rounded corners locally/globally on the path?



  (0,0) {[rounded corners=15pt] --
  ++(2,0)  -- 
  ++(0,1)} --
  ++(-2,0) --
\draw[rounded corners=15pt]
  (4,0) rectangle ++(2,1);


enter image description here

  • @Gonzalo Mendina What do -- and plus plus do
    – Vaibhav
    Commented Nov 10, 2014 at 4:02
  • @gonzalo Medina please how to write under it ?
    – Vrouvrou
    Commented Mar 26, 2018 at 19:29

A PSTricks solution:




  % right end round
  % left end round
  % both ends round



\draw[rounded corners](0,0)--(5,0)--(5,10)--(0,10)--cycle;
  • or a bit shorter: \draw[rounded corners] (0,0) |- (5,10) |- cycle; ... , anyway +1
    – Zarko
    Commented May 31, 2022 at 17:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .