Many aspects of HIV-1 pathogenesis are affected by Nef protein activity, and efforts have been made to study variation in the nef gene and how that variation relates to disease outcome. We studied the genetic diversity of the nef gene in distinct clones obtained from the same patient (intrahost) and in sequences obtained from different hosts (interhost). The set of sequences analyzed was obtained from HIV-1-infected Brazilian children and contained 112 clones from 25 children (intrahost samples), as well as 55 sequences from epidemiologically unlinked children (interhost samples). We found extensive site polymorphisms and amino acid length variations, mainly in the amino terminal region of the nef gene, between the myristoylation motif (MGxxxS) and the MHC-1 downregulation motif (Rxx). Analysis of the sequences deposited in the Los Alamos HIV sequences database ( www.hiv.lanl.gov ) indicated that the most frequent motif at the MHC-1 downregulation site in the subtype B strain is R(86%)A(64%)E(82%) (n = 1040) and R(78%)T(74%)E(56%) in the subtype C strain (n = 549). Conversely, the Brazilian subtype B isolates presented the motif R(81%)T(62%)E(67%) at this site (n = 64). A detailed analysis of selective pressures identified a concentration of codons under strong positive selection in the amino terminal region of the nef gene. We also determined that different sites are under positive selection in the subtype B and subtype C viruses. The amino acid composition in the MHC-1 downregulation motif of the nef gene in our sequences may indicate a distinct adaptive pattern of HIV-1 subtype B to the Brazilian host population.