The object of this article is to characterize the family of all distribution-free (DF) tests of independence, and those subfamilies which are optimal for specified alternative classes. It is found (Theorem 3.2) that each DF statistic is a function of a Pitman (or permutation) statistic; and (Theorem 3.4) that the rank statistics are those whose distributions depend appropriately on the maximal invariant [Lehmann (1959), p. 227]. For parametric alternatives the MP (most powerful) [Lehmann and Stein (1949)] and the locally MP tests are found to be Pitman tests based on the likelihood function (Lemma 4.1 and Theorem 4.1); while the corresponding optimal rank tests are analogous (Lemmas 4.2, 4.3) to those in the 2-sample case [e.g. Capon (1961)], and are closely related to those of Bhuchongkul (1964). In Section 5 randomized statistics similar to those of [4] are shown (Corollary 5.2) to be asymptotically equivalent to the optimal nonrandomized statistic for specified parametric alternatives. For one reasonable nonparametric class of alternatives one proves (Theorem 6.1) that the normal scores test is minimax; while for the other class an unexpected statistic (Theorem 6.2) is minimax. Finally, in Section 7 the ideas of monotone tests developed by Chapman (1958) and others are extended, and analogous results (Theorem 7.1) are obtained for minimum power.