What is the difference between dense and closed sets?

$[0,1]$ is a closed subset of $\mathbb R$ that is not dense. It contains all of its limit points, so it is closed. Some points in $\mathbb R$, for example $2$, are not limit points of this set, so the set is not dense.

$\mathbb Q$ is a dense subset of $\mathbb R$ that is not closed. It is not closed because it does not contain all of its limit points. For example $\sqrt 2$ is a limit point of this set because every open neighborhood of $\sqrt 2$ contains some rational numbers. It is dense because every point in $\mathbb R$ is one of its limit points.


I want to add one thing. The only closed, dense set in a topological space is the space itself!

So these two concepts are pretty far apart. So far that in most situations, they are mutually exclusive!


A set is dense/closed in a given topological space.

$[0,1]$ is closed in $\mathbb{R}$ but it is not dense in $\mathbb{R}$ since there are real numbers that can not be approached arbitrarily close by elements of $[0,1]$.

$[0,1]\setminus\{\frac{1}{2}\}$ is dense in $[0,1]$ but it is not closed in it.