Parents will be able to have their children opt out of the lessons on birth-control methods. City officials said that while there would be frank discussions with students as young as 11 on topics like anatomy, puberty, pregnancy and the risks of unprotected sex, the focus was to get students to wait until they were older to experiment. At the same time, knowing that many teenagers are sexually active, the administration wants to teach them about safe sex in the hopes of reducing pregnancy, disease and dropouts.

Some are already preparing for a backlash.

“We’re going to have to be the bridge between the chancellor’s requirements and the community,” said Casimiro Cibelli, principal of Middle School 142 in the Baychester section of the Bronx, where many of the students come from immigrant, religious families with traditional views on sex. “Hopefully, we’ll allay their concerns because of their trust in us.”

At Mr. Cibelli’s school, the current semester-long health course does not stray from subjects like nutrition and physical fitness.

The new classes, which will be coeducational, could be incorporated into existing health education classes, so principals will not have to scramble to find additional instructional time. The classes would include a mix of lectures, perhaps using statistics to show that while middle school students might brag about having sex, not many of them actually do; group discussions about, for example, why teenagers are often resistant to condoms; and role-playing exercises that might include techniques to fend off unwanted advances.

Schools that have not been offering sex education — the number is unclear because the city’s Department of Education has not kept a tally, a spokeswoman said — can hire a teacher to do it or assign the task to one who is already on the staff. The department will offer training sessions before the start of classes Sept. 8.

Some New Yorkers of older generations remember explicit sex-education classes with frank talk about libido and demonstrations of how to use a diaphragm.

In 1987, the state mandated the adoption of an H.I.V./AIDS curriculum in every school. For students in the city, that has meant at least five class sessions each year, from kindergarten through 12th grade. In those classes, younger students are taught to avoid touching open wounds, and older ones are talked to about sex, but not necessarily about preventing pregnancies.