Although several peptides have been found to bind to both class I and class II molecules, the basis for this binding of the same peptide to two classes of MHC molecules has not been compared previously. We have analyzed one such peptide, P18 from the V3 loop of HIV-1 gp160, which we have previously shown to be recognized by CD8+ CTL with the class I molecule H-2Dd, and by CD4+ Th cells with the class II molecule I-Ad. With the use of truncated and substituted peptides, we found that the minimal core peptides are very similar, that the residues required for class I binding precisely fit the recently identified consensus motif for peptides binding to Dd (XGPX[R/K/H]XXX(X) [L/I/F]), and that at least three of the same residues are involved in binding to class II I-Ad. In addition, several of the same residues are involved in TCR interaction when the peptide is presented by class I and class II molecules. Modeling shows results to be consistent with the crystal structure of a peptide-class II MHC complex. Thus, the recognition of this versatile peptide by CD4+ Th cells with class II MHC molecules and by CD8+ cytotoxic T cells with class I MHC molecules is remarkably similar in both the core peptide used and the role of different residues in the ternary complex.