The ex-president was quizzed for the BBC by Prince Harry, in his first interview since leaving office.
Former US President Barack Obama has warned against the irresponsible use of social media, in a rare interview since stepping down in January.
He warned that such actions were distorting people’s understanding of complex issues, and spreading misinformation.
“All of us in leadership have to find ways in which we can recreate a common space on the internet,” he said.
Mr Obama was quizzed by Prince Harry on BBC Radio 4’s Today programme.
Prince Harry, fifth in line to the throne, is one of several prominent figures who are guest-editing the programme over the Christmas period.
The former president expressed concern about a future where facts are discarded and people only read and listen to things that reinforce their own views.
“One of the dangers of the internet is that people can have entirely different realities. They can be cocooned in information that reinforces their current biases.
“The question has to do with how do we harness this technology in a way that allows a multiplicity of voices, allows a diversity of views, but doesn’t lead to a Balkanisation of society and allows ways of finding common ground,” he said.
Mr Obama’s successor Donald Trump is a prolific user of Twitter, but Mr Obama did not mention him by name.
Mr Trump has been accused of overusing Twitter and following only a narrow range of users, though he maintains it allows him to connect directly with the American people.
Mr Obama suggested face-to-face contact would help counteract extreme views.
“Social media is a really powerful tool for people of common interests to convene and get to know each other and connect.
“But then it’s important for them to get offline, meet in a pub, meet at a place of worship, meet in a neighbourhood and get to know each other.
“Because the truth is that on the internet, everything is simplified and when you meet people face-to-face it turns out they’re complicated.”
“It’s hard, being in the public eye is unpleasant in a lot of ways. It is challenging in a lot of ways.
“Your loved ones are made vulnerable in ways that might not have been true 20 years ago or 30 years ago.
“So it is a sacrifice that I think everybody has to be at peace with when they decide to go into politics. But, ultimately, I think the rewards of bringing about positive change in this world make it worthwhile.”
Mr Obama pays tribute to the support of his family, especially his wife Michelle, describing how glad he is that she was “my partner throughout that whole process”.
Mixed feelings given “all the work that was still undone”.
“Concerns about how the country moves forward but, you know, overall there was serenity there,” he added.
Mr Obama compared his time in office to being a relay runner.
“If you ran hard, you did your best and you were able to pass that baton successfully and the world was a little better then you had done your job.”
He cites Obamacare – ensuring more people can afford basic healthcare – as a major achievement.
“What an enormous blessing it is to say that 20 million Americans have health insurance that didn’t have it before.”
Without dismissing the problems faced by the world, he remains an optimist.
“If we take responsibility for being involved in our own fate, if we participate, if we engage, if we speak out, if we work in our communities, if we volunteer, then all the problems that we face are solvable despite all the terrible news that you see.
“If you had to choose a moment in human history in which you’d want to be born you’d choose today because the fact is that the world is healthier, wealthier, better educated and more tolerant, more sophisticated and less violent.”
As well as editing, Prince Harry was himself interviewed on Today.
“I haven’t done that many interviews but it was quite fun, especially interviewing President Obama despite the fact he wanted to interview me.
“It’s been a big learning curve but also these are incredibly important topics we all need to think about and need to be discussed.”
The prince’s programme focused on issues such as the armed forces, mental health, youth crime and climate change.
Police warn of hazardous driving conditions on roads, as thousands of homes are left without power.