Charts and Diagrams

How to Draw a Venn Diagram in LaTeX with TikZ

Draw a Venn diagram in LaTeX with TikZ. Covers two-set and three-set diagrams with transparent fills, numbered regions, a universal set, and common fixes.

On this page
  1. What a Venn diagram needs
  2. Draw a two-set Venn diagram
  3. Draw a three-set Venn diagram
  4. Add a universal set
  5. Common problems
  6. Where to go next
  7. Frequently asked questions

What a Venn diagram needs

A Venn diagram shows sets as overlapping circles. The overlap holds the elements that belong to more than one set. TikZ draws the circles, and transparent fills make the overlaps visible. Two or three sets are common. With more sets, the diagram gets hard to read, and a table may be clearer.

Draw a two-set Venn diagram

Put this inside a document that loads TikZ with \usepackage{tikz}:

\begin{tikzpicture}
  \draw[fill=red, fill opacity=0.3] (0,0) circle (1.5cm);
  \draw[fill=blue, fill opacity=0.3] (2,0) circle (1.5cm);
  \node at (-1.2,1.2) {$A$};
  \node at (3.2,1.2) {$B$};
\end{tikzpicture}

circle (1.5cm) sets the radius. The centers are 2 cm apart, which is less than the 3 cm sum of the radii, so the circles overlap. fill opacity=0.3 makes each fill translucent, so the overlap shows as a darker region. The set names sit outside each circle.

Draw a three-set Venn diagram

Three circles need region labels in each part of the diagram. Short labels fit best, because the center region is narrow:

\begin{tikzpicture}
  \draw[fill=red, fill opacity=0.3]   (0,0)   circle (1.5cm);
  \draw[fill=green, fill opacity=0.3] (2,0)   circle (1.5cm);
  \draw[fill=blue, fill opacity=0.3]  (1,1.7) circle (1.5cm);

  % Set names
  \node at (-1.2,1.2) {$A$};
  \node at (3.2,1.2)  {$B$};
  \node at (1,3.4)    {$C$};

  % Region numbers (see the key below)
  \node at (-0.6,0.2) {1};
  \node at (2.6,0.2)  {2};
  \node at (1,2.6)    {3};
  \node at (1,-0.4)   {4};
  \node at (0.2,1.1)  {5};
  \node at (1.8,1.1)  {6};
  \node at (1,0.7)    {7};
\end{tikzpicture}

The key for the numbers is:

  • 1: A only
  • 2: B only
  • 3: C only
  • 4: A and B only
  • 5: A and C only
  • 6: B and C only
  • 7: all three sets

The label coordinates come from the circle geometry. Each point lies inside the circles named in its key and outside the others. To check a new position, measure its distance from each circle’s center: it is inside a circle when that distance is less than 1.5 cm.

Replace the numbers with your own labels or counts.

Add a universal set

A universal set is usually drawn as a rectangle around all the circles. Draw the rectangle first, so the circles are drawn over it, and label one corner with $U$:

\begin{tikzpicture}
  \draw (-2.5,-2.5) rectangle (4.5,4.5);
  \node at (-2.1,4.1) {$U$};
  \draw[fill=red, fill opacity=0.3]   (0,0)   circle (1.5cm);
  \draw[fill=green, fill opacity=0.3] (2,0)   circle (1.5cm);
  \draw[fill=blue, fill opacity=0.3]  (1,1.7) circle (1.5cm);
\end{tikzpicture}

The rectangle is large enough to hold all three circles with some room to spare.

Common problems

  • Overlaps look too dark. Lower fill opacity to 0.2.
  • A region label is hidden. Place the labels after the circles in the code, so they are drawn on top of the fills.
  • Labels run into the circle edges. Use short labels, such as numbers or single letters, and check each position against the circles.
  • The circles look like they show set sizes. Equal circles do not represent counts. See the FAQ below.

Where to go next

For other diagram types, see the block diagrams and flowcharts guide. To write union, intersection, and other set notation in your text, see set, number and currency symbols in LaTeX.

Frequently asked questions

Does a TikZ Venn diagram show exact proportions?

No. The circles are placed by hand, so the overlaps are a visual guide rather than a scaled area. If readers need exact counts, state them in a table or in the caption.

Can I use words instead of numbers in the regions?

Yes, but keep the words short. The center region is narrow, so a long label will spill over the circle edges. Use a smaller font size if you need more text.

The complete guide to charts and diagrams

Drawing Block Diagrams and Flowcharts in LaTeX
Read the guide

Keep exploring

Guides from other topics

All topics →