Douady and Hubbard introduced the operation of mating of polynomials. This identifies two filled Julia sets and the dynamics on them via external rays. In many cases one obtains a rational map. Here the opposite question is tackled. Namely we ask when a given (postcritically finite) rational map f arises as a mating. A sufficient condition when this is possible is given. If this condition is satisfied, we present a simple explicit algorithm to unmate the rational map. This means we decompose f into polynomials, that when mated yield f. Several examples of unmatings are presented.