Suburb or city? It's a question many parents grapple with upon starting a family, and it's even more prescient in a pricy place like the San Francisco.

When Deepak Gupta moved to San Francisco in his twenties, he remembers being "enamored with it." In the city, he made his career, met his wife and eventually became a father.

But soon after the birth of his first child, Gupta quickly found renting a two-bedroom condo in Hayes Valley unlivable.

"I was bursting at the seams," he said. "We just needed more space."

The family moved across the Bay, to Oakland, where the kids could grow up with a backyard and space to roam.

In a city like San Francisco, where childcare can cost more than a minimum-wage worker's annual salary, the economics don't balance the benefits for many parents. And godspeed finding an affordable house with enough space for a swing set.

Paul Gallagher and his wife lived in San Francisco for more than 20 years before deciding to move to Nashville with their 8-year-old son.

"We had great careers, made money, but at some point we looked at each other and said, we've had all this success, why are we killing ourselves to hold it together in San Francisco?"

Putting 10 hours in at the office only to come home for an hour-and-half with his child before having to sign on again "wasn't worth it anymore," said Gallagher, a senior strategic project manager at a regional bank. In March, he moved to Nashville, chosen partially due to its warm climate. His wife and son followed in the summer.

Leaving wasn't easy. If the Bay Area is financially viable for a family, raising children here can be incredibly rewarding. Suburban sprawl, shopping malls and Chipotles hardly compare to days at the De Young, evenings at the Orpheum and afternoons in Golden Gate Park.

Faced with the choice to stay or go, however, it seems many choose the latter. Less than 14 percent of the city's population is under 18, compared to 21 percent in New York and 23 percent in Chicago.

Those who decide to start a family, often do so later than their peers nationwide. Women in San Francisco become first-time mothers later than anywhere else in the country, according to a recent New York Times study. Manhattan mothers trailed closely behind in the ranking, as did those in Marin County.

The Times study claimed education was the biggest factor influencing the age one enters motherhood, but in San Francisco, the high cost of real estate and child care are often insurmountable to those just beginning their careers. Behind housing, child care is often the most significant expense for families, according to the Children's Council San Francisco. The organization estimates it costs up to $29,508 for the care of children up to age two, and $22,560 for those between age two and five.

It's not just San Francisco, with its public-school lottery and dearth of housing, that poses a challenge to child-rearing. Many parents find the Bay Area at-large not worth the cost.

"I was pretty much a single mom," Toni Eckert said of raising children in San Jose and later Fremont. Her husband, a journeyman carpenter, "had to work six to seven days a week just to keep up with costs."

More Information Did you recently leave the Bay Area? Tell us where you went and why you left by emailing SFGATE reporter Michelle Robertson at mrobertson@sfchronicle.com. See More Collapse

And there was the matter of safety. Eckert says she longed for the San Jose of her youth, when children could freely traipse about the neighborhood and "block parents" collectively watched out for each other's offspring.

"By the time I was raising kids, I wouldn't take my eyes off them for a second," Eckert said.

She and her family moved to Chester, a tiny town in the shadow of Mount Lassen, about five hours north of San Jose. Eckert's three kids could "go fishing, ride their bikes around town, take themselves to Little League" — without constant adult supervision. The neighbors, she said, watched out for one another, just as it was when she was a kid.

The Dobrinskis also left the Bay Area in pursuit of a more neighborly vibe, which they say they found in Sacramento.

"When you spend more time in your yard, and live in an area with larger sidewalks and quieter streets, you see more of your neighbors. People stop and talk," said Kele Dobrinski. It was a refreshing change after living in a series of San Francisco apartments where they "rarely knew another person on our block."

"There are parts of the city we will always love," Dobrinski said, "but so much changes once you have kids."

Some families leave California altogether. Jim Pape and his wife lived in the state for nearly 20 years before Pape "took a chance" on a job opportunity at a startup in Tulsa. The family lasted three years in Oklahoma. They moved back to the Bay Area earlier in the summer.

"It's not about Tulsa being broken; it's actually a very normal place," Pape insisted. The Bay Area, however, "is just a really unique place."

Leaving, he says, opened his eyes to the exceptional quality of life in the Bay Area, a lifestyle he realized his kids deserved to grow up in.

The Bay Area, he said, has a built-in "context of achievement."

"There's this attitude here that anything is possible, that expects a high level of professional achievement," he said. "That's a better context for my kids to grow up in."

In Oklahoma, he said he had to pay for that "high-achievement expectation" by enrolling his children in private schools.

"Here, it's just in the water, and you pay for that."

Upon his family's return to the Bay Area, Pape said he looked at the expensive region with his eyes open, his expectations realistic.

"I recently went to register my car, knowing it would be ridiculously expensive," he said. It was.

"The guy next to me in line was outraged by the cost," he said. "I just smiled."

Read Michelle Robertson's latest stories and send her news tips at mrobertson@sfchronicle.com.

Start receiving breaking news emails on wildfires, civil emergencies, riots, national breaking news, Amber Alerts, weather emergencies, and other critical events with the SFGATE breaking news email. Click here to make sure you get the news.