Simple: It depends on what kind of private pilot you want to be. Most likely, the student who will be the better pilot is does ground school online. I would rather fly with the pilot who taught themselves and didn’t use the school. Why? Let me tell a story.
There are several flight schools nearby that offer ground schools for various pilot certificates and ratings. One of them offers a three day course for $500 (plus tax!). On the third day, you take the test (at their facility). Most people pass it the day the course ends.
There are several positives to this format. You get done quick. You have structure. It’s in person, so you can ask questions. Most likely you get your ticket.
On the downside, it’s expensive. And I can’t speak for every school, but mostly they teach to the test. You study hard for three days, pass the test, and a week later you forget what you “learned”. You may not have a good instructor.
In person school is an expensive, low quality solution. They teach to the test and you’ll soon forget most of what you learned. It’s for people who need structure, just want to check the box, and don’t care about money.
There is a better way, but it's harder. It takes more longer. You have to be self-motivated. But you end up a better pilot.
There are several different ways to study independently. Fly8ma.com, MZeroA.com, and other offer a structured program. Or you can buy a textbook, some flashcards, use the Sporty’s online test bank, and you will pass. But whatever approach you use, you will get a better education than a short weekend course can offer.
You should start with the FAA Pilot’s Handbook of Aeronautical Knowledge. It is the source from which all test questions are drawn. If you read it cover to cover, and you should, you’ve probably already spend more time than you would have spent at a flight school. Fly8ma offers ground school for free on YouTube. I didn’t add up the total minutes, but the Fly8ma online ground school easily exceeds the 24 hours you would spend at a flight school. Online almost guarantees you will have a good instructor, since you choose the instructor.
The problem with getting your private pilot certificate is that it’s merely a license to learn. You literally don’t know what you don’t know. So you learn everything for memory, and you don’t really understand it in depth. Flight schools offering ground school give you only the most superficial presentation of the material.
If you need the structure and socializing of a flight school, go for it. Nobody says you can’t also do online grounds school, read the textbooks, and study on your own. We recommend it, and you need it. But it’s a poor cost/benefit proposition.
Independent study is much more comprehensive. It makes you more knowledgeable. It shows that you care about your training. It shows you’re smart with money. It makes you a better pilot.
So should you do ground school in person, or online? We advise students to do it online, obviously. Both methods are successful. But one method is cheaper, teaches you more, and makes you a better pilot.
For the next level certificates and ratings, the equation is different because you're already a knowledgeable pilot. But for the private pilot certificate, the balance points in favor of independent study.
Whichever option you choose, we encourage you to do everything you can to be the best, safest pilot you can be. Because the private pilot license is a license to learn.