Options for venting a bathroom exhaust fan include best to worst.
Bathroom vent fan venting into attic.
When venting a bathroom exhaust fan make sure to vent the air to the outside rather than into your attic where it can cause mold and mildew to form.
Your attic is not a temperature controlled environment is never the same temperature as your living space and generally closer to the temperature outside.
Depending on the location of the bathroom it may be easy to vent the exhaust fan through the roof.
Bathroom ventilation codes require a bathroom exhaust fan to vent to the exterior not the attic for health and structural reasons.
In order to accomplish this the roof has to have a hole cut in it.
However you can vent a bathroom fan through an attic while it terminates on the roof or gable end.
Bathroom code does address the issue of moving odor and moisture laden air from the bathroom to the outside.
Through the roof or an exterior gable wall.
The exhaust vent must terminate outdoors.
You should never exhaust the bathroom fan directly into the attic.
All municipalities have different requirements but some do not draw a hard line on requiring exhaust fans.
Bathroom fan vent code requirements include no venting to attic areas to help reduce mold or structural problems.
Surprisingly bathroom fans are not required by some building codes.
This involves running ductwork from the fan usually though an attic and out through the roof.
No you should not vent a bathroom fan directly into an attic.
It is because of this that many builders tend to advise against this method.