A code C is Z 2 Z 4 -additive if the set of coordinates can be partitioned into two subsets X and Y such that the punctured code of C by deleting the coordinates outside X (respectively, Y ) is a binary linear code (respectively, a quaternary linear code). The corresponding binary codes of Z 2 Z 4 -additive codes under an extended Gray map are called Z 2 Z 4 -linear codes. In this paper, the invariants for Z 2 Z 4 -linear codes, the rank and dimension of the kernel, are studied. Specifically, given the algebraic parameters of Z 2 Z 4 -linear codes, the possible values of these two invariants, giving lower and upper bounds, are established. For each possible rank r between these bounds, the construction of a Z 2 Z 4 -linear code with rank r is given. Equivalently, for each possible dimension of the kernel k, the construction of a Z 2 Z 4 -linear code with dimension of the kernel k is given. Finally, the bounds on the rank, once the kernel dimension is fixed, are established and the construction of a Z 2 Z 4 -linear code for each possible pair (r, k) is given.