Rank of a group
In the mathematical subject of group theory, the rank of a group G, denoted rank(G), can refer to the smallest cardinality of a generating set for G, that is

If G is a finitely generated group, then the rank of G is a nonnegative integer. The notion of rank of a group is a group-theoretic analog of the notion of dimension of a vector space. Indeed, for p-groups, the rank of the group P is the dimension of the vector space P/Φ(P), where Φ(P) is the Frattini subgroup.

The rank of a group is also often defined in such a way as to ensure subgroups have rank less than or equal to the whole group, which is automatically the case for dimensions of vector spaces, but not for groups such as affine groups.  To distinguish these different definitions, one sometimes calls this rank the subgroup rank.  Explicitly, the subgroup rank of a group G is the maximum of the ranks of its subgroups:

Sometimes the subgroup rank is restricted to abelian subgroups.

Known facts and examples
For a nontrivial group G, we have rank(G) = 1 if and only if G is a cyclic group. The trivial group T has rank(T) = 0, since the minimal generating set of T is the empty set.
For a free abelian group  we have 
If X is a set and G = F(X) is the free group with free basis X then rank(G) = |X|.
If a group H is a homomorphic image (or a quotient group) of a group G then rank(H) ≤ rank(G).
If G is a finite non-abelian simple group (e.g. G = An, the alternating group, for n > 4) then rank(G) = 2. This fact is a consequence of the Classification of finite simple groups.
If G is a finitely generated group and Φ(G) ≤ G is the Frattini subgroup of G (which is always normal in G so that the quotient group G/Φ(G) is defined) then rank(G) = rank(G/Φ(G)).
If G is the fundamental group of a closed (that is compact and without boundary) connected 3-manifold M then rank(G)≤g(M), where g(M) is the Heegaard genus of M.
If H,K ≤ F(X) are finitely generated subgroups of a free group F(X) such that the intersection  is nontrivial, then L is finitely generated and
rank(L) − 1 ≤ 2(rank(K) − 1)(rank(H) − 1).
This result is due to Hanna Neumann. The Hanna Neumann conjecture states that in fact one always has rank(L) − 1 ≤ (rank(K) − 1)(rank(H) − 1). The Hanna Neumann conjecture has recently been solved by Igor Mineyev and announced independently by Joel Friedman.
According to the classic Grushko theorem, rank behaves additively with respect to taking free products, that is, for any groups A and B we have
rank(AB) = rank(A) + rank(B).
If  is a one-relator group such that r is not a primitive element in the free group F(x1,..., xn), that is, r does not belong to a free basis of F(x1,..., xn), then rank(G) = n.

The rank problem
There is an algorithmic problem studied in group theory, known as the rank problem. The problem asks, for a particular class of finitely presented groups if there exists an algorithm that, given a finite presentation of a group from the class, computes the rank of that group. The rank problem is one of the harder algorithmic problems studied in group theory and relatively little is known about it. Known results include:

The rank problem is algorithmically undecidable for the class of all finitely presented groups. Indeed, by a classical result of Adian–Rabin, there is no algorithm to decide if a finitely presented group is trivial, so even the question of whether rank(G)=0 is undecidable for finitely presented groups.
The rank problem is decidable for finite groups and for finitely generated abelian groups.
The rank problem is decidable for finitely generated nilpotent groups. The reason is that for such a group G, the Frattini subgroup of G contains the commutator subgroup of G and hence the rank of G is equal to the rank of the abelianization of G.
The rank problem is undecidable for word hyperbolic groups.
The rank problem is decidable for torsion-free Kleinian groups.
The rank problem is open for finitely generated virtually abelian groups (that is containing an abelian subgroup of finite index), for virtually free groups, and for 3-manifold groups.

Generalizations and related notions
The rank of a finitely generated group G can be equivalently defined as the smallest cardinality of a set X such that there exists an onto homomorphism F(X) → G, where F(X) is the free group with free basis X. There is a dual notion of co-rank of a finitely generated group G defined as the largest cardinality of X such that there exists an onto homomorphism G → F(X). Unlike rank, co-rank is always algorithmically computable for finitely presented groups, using the algorithm of Makanin and Razborov for solving systems of equations in free groups.
The notion of co-rank is related to the notion of a cut number for 3-manifolds.

If p is a prime number, then the p-rank of G is the largest rank of an elementary abelian p-subgroup.  The sectional p-rank is the largest rank of an elementary abelian p-section (quotient of a subgroup).

See also
Rank of an abelian group
Prüfer rank
Grushko theorem
Free group
Nielsen equivalence

Notes

Group theory