Fertile Window

How long is a woman's fertile window? and when it okay to have sex to avoid pregnancy? Before or after your fertile window? Really trying to avoid pregnancy.