There are a few factors that have a strong association with religious affiliation, like whether your parents were religious and how much formal education you have, but Professor Allen B. Downey of the Olin College of Engineering in Massachusetts says there’s another factor that has more influence than either of those options: The Internet.
… it is easy to imagine at least two ways Internet use could contribute to disaffiliation. For people living in homogenous communities, the Internet provides opportunities to find information about people of other religions (and none), and to interact with them personally. Also, for people with religious doubt, the Internet provides access to people in similar circumstances all over the world. Conversely, it is harder (but not impossible) to imagine plausible reasons why disaffiliation might cause increased Internet use.