Let

be a given subset of binary n-sequences. We provide an explicit scheme for calculating the index of any sequence in

according to its position in the lexicographic ordering of

. A simple inverse algorithm is also given. Particularly nice formulas arise when

is the set of all

-sequences of weight

and also when

is the set of all sequences having a given empirical Markov property. Schalkwijk and Lynch have investigated the former case. The envisioned use of this indexing scheme is to transmit or store the index rather than the sequence, thus resulting in a data compression of

.