A procedure for ordering a set of individuals into a linear or near-linear dominance hierarchy is presented. Two criteria are used in a prioritized way in reorganizing the dominance matrix to find an order that is most consistent with a linear hierarchy: first, minimization of the numbers of inconsistencies and, second, minimization of the total strength of the inconsistencies. The linear ordering procedure, which involves an iterative algorithm based on a generalized swapping rule, is feasible for matrices of up to 80 individuals. The procedure can be applied to any dominance matrix, since it does not make any assumptions about the form of the probabilities of winning and losing. The only assumption is the existence of a linear or near-linear hierarchy which can be verified by means of a linearity test. A review of existing ranking methods is presented and these are compared with the proposed method. Copyright 1998 The Association for the Study of Animal Behaviour. Copyright 1998 The Association for the Study of Animal Behaviour.