  We introduce and study a complexity function on words $c_x(n),$ called
\emph{cyclic complexity}, which counts the number of conjugacy classes of
factors of length $n$ of an infinite word $x.$ We extend the well-known
Morse-Hedlund theorem to the setting of cyclic complexity by showing that a
word is ultimately periodic if and only if it has bounded cyclic complexity.
Unlike most complexity functions, cyclic complexity distinguishes between
Sturmian words of different slopes. We prove that if $x$ is a Sturmian word and
$y$ is a word having the same cyclic complexity of $x,$ then up to renaming
letters, $x$ and $y$ have the same set of factors. In particular, $y$ is also
Sturmian of slope equal to that of $x.$ Since $c_x(n)=1$ for some $n\geq 1$
implies $x$ is periodic, it is natural to consider the quantity
$\liminf_{n\rightarrow \infty} c_x(n).$ We show that if $x$ is a Sturmian word,
then $\liminf_{n\rightarrow \infty} c_x(n)=2.$ We prove however that this is
not a characterization of Sturmian words by exhibiting a restricted class of
Toeplitz words, including the period-doubling word, which also verify this same
condition on the limit infimum. In contrast we show that, for the Thue-Morse
word $t$, $\liminf_{n\rightarrow \infty} c_t(n)=+\infty.$
