We show that the Mallows measure on permutations of 1, . . . , n arises as the law of the unique Gale-Shapley stable matching of the random bipartite graph conditioned to be perfect, where preferences arise from a total ordering of the vertices but are restricted to the (random) edges of the graph. We extend this correspondence to infinite intervals, for which the situation is more intricate. We prove that almost surely every stable matching of the random bipartite graph obtained by performing Bernoulli percolation on the complete bipartite graph K Z,Z falls into one of two classes: a countable family (σn) n∈Z of tame stable matchings, in which the length of the longest edge crossing k is O(log |k|) as k → ±∞, and an uncountable family of wild stable matchings, in which this length is exp Ω(k) as k → +∞. The tame stable matching σn has the law of the Mallows permutation of Z (as constructed by Gnedin and Olshanski) composed with the shift k → k + n. The permutation σn+1 dominates σn pointwise, and the two permutations are related by a shift along a random strictly increasing sequence.