Smoking in your car is harmful to you and your passengers, but it also hurts the resale value of your car.

A study by the National Center for Biotechnology Information, or NCBI, estimates that smoking in a car reduces its resale value by 7.7%.

In evaluating the same car two different ways (smoked in and never smoked in), online used-car retailer Vroom's appraisal tool reduced the company's purchase offer by $1,000. Carvana's reduction was less for the same car, cutting its offering price by only $289.

When cars are evaluated for trade-in, a number of factors affect their value, such as mechanical condition and the number of miles driven. The condition of the interior is another big factor: The smell of smoke makes a vehicle harder to sell and is expensive to recondition.

Smoke "will permeate the entire vehicle interior," says Michael Stoops, senior global product and training specialist for Meguiar's car care products. The odor stubbornly lingers — even in "areas you can neither see nor reach, such as inside the air-conditioning system."

Lighting a cigarette in a car is unhealthy for even nonsmoking passengers, and the threat remains long after the cigarette is extinguished. "Third-hand smoke" refers to the gases and particulates absorbed by the car's interior and then re-emitted over time.

This second- and third-hand smoke is especially hazardous for young people.

"Several studies show that kids, cars and cigarettes are a particularly dangerous combination," according to the American Nonsmokers' Rights Foundation.

In fact, smoking in a car with a young person is illegal in nine states and Puerto Rico: It's outlawed for anyone driving with a passenger under a certain age.

Can you get rid of the smoking smell in your car?

If you buy a used car and later detect a smoke smell, or you are selling a car that you've smoked in and don't want to take a hit on the resale value, all is not lost.

Products to treat or eliminate smoke smell abound. For example, Meguiar's Air Re-Fresher canister dispenses while the engine is running and the air conditioning is on high and recirculating mode. It and similar products sell for about $10 for a single canister.

Cleaning services have had success using ozone generators to extract the cigarette smell. Mike Lightman, owner of Odor Removal Experts of OC says the treatment costs $169 for a midsize sedan. The car is left running during the process so the ventilation system can circulate.

Reed is auto writer for NerdWallet.com.