It’s no secret that Facebook makes a lot of money. But how Facebook makes that money, as a service that’s provided to users for free, is a little complicated. It’s so complicated that Senators repeatedly grilled Mark Zuckerberg about the ins and outs of how the service creates revenue when he testified before Congress in April.

It’s important to start by saying that you could argue that Facebook is not actually a free service, because users provide Facebook with data every day in exchange for the ability to use the platform. In turn, Facebook is able to translate your likes, locations, photos and other activity online into cold, hard cash. Like, $40 billion in revenue in 2017, to be specific. This how it does it:

Facebook
Facebook's over two billion users translate into a lot of revenue opportunities.

Ads, Ads, Ads

This is what the majority of Facebook’s revenue comes from. The social media giant uses a lot of what it knows about you to show you ads it thinks you might like, and advertisers pay Facebook to plug their products to the right customers. It’s called targeted ads, and it’s almost the entire way that company keeps the lights on; nearly all of its $40 billion revenue comes specifically from targeted ads. Facebook doesn’t technically sell your data to outsiders, it sells access to you based on your data.

Games and Other In-App Payments

In 2017, Facebook earned $711 million off of various payed services, like purchases of desktop games offered in-app. This revenue stream has actually slowed down over the past several years. “This decline is likely a reflection of the general shift away from desktop to mobile and mobile games,” Kristina Varshavskaya, a former Product Designer at Facebook, wrote on Quora in April.

Oculus Rift (Some Day)

That $711 million figure above included the sales of Oculus products, Facebook’s VR headset and additional gear. Although a costly acquisition at $2 billion back in 2014, Occulus hasn’t been a big breadwinner so far. With Oculus Go, a new, inexpensive version of the Oculus product now available, Mark Zuckerberg might inch closer to his dream of integrating VR into the Facebook user experience — using his products, of course.

Facebook Watch (Also Some Day)

Continuing to grow Facebook’s video venture is something that the social media behemoth has its eye one. Hoping to partner with content creators to showcase long-form, episodic series, Facebook Watch is a savvy strategy for keeping people on the platform for longer, as well as a new opportunity for advertisers, who can run commercials during shows.

At an earnings call in April, Zuckerberg echoed the sentiments that Facebook Watch is an exciting venture, tempering this by noting it’s a little early to tell how well Watch is really doing. “We are trying to make it a different experience from what you can get on YouTube… A bunch of the content that has come onto Watch is good and is working,” he said.

Disclaimer: Facebook Watch partnered with Inverse for the shows Button Mashers and Big Ideas with Little Kids in 2017.