Abstract The number of linearly independent perfect matchings of a graph — or, equivalently, the dimension of the perfect matching polytope — is determined in various senses. First it is shown that the fact that every linear objective function can be optimized over the perfect matchings in polynomial time implies the existence of a polynomial-time algorithm to determine the dimension of this set. This observation also yields polynomial algorithms to determine, among others, the number of linearly independent common bases of two matroids and the number of linearly independent maximum stable sets in claw-free or perfect graphs. For the case of perfect matchings, Naddef’s minimax theorem for the dimension of the perfect matching polytope is strengthened and it is shown how the decomposition theory of matchings in graphs can be applied to derive a particularly simple formula for this dimension. This formula is based upon the number of constituents of a certain decomposition of the graph which we call a brick decomposition. Finally, these results are applied to obtain a description of the facets of the perfect matching polytope.