summary:The concept of rank of a commutative cancellative semigroup is extended to all commutative semigroups $S$ by defining $\mathop{\rm rank}S$ as the supremum of cardinalities of finite independent subsets of $S$. Representing such a semigroup $S$ as a semilattice $Y$ of (archimedean) components $S_\alpha $, we prove that $\mathop{\rm rank}S$ is the supremum of ranks of various $S_\alpha $. Representing a commutative separative semigroup $S$ as a semilattice of its (cancellative) archimedean components, the main result of the paper provides several characterizations of $\mathop{\rm rank}S$; in particular if $\mathop{\rm rank}S$ is finite. Subdirect products of a semilattice and a commutative cancellative semigroup are treated briefly. W...