Are you a Carrie, Samantha, Charlotte or Miranda?

That question has been asked a zillion times, thanks to “Sex and the City,” the HBO comedy that made Cosmo cocktails a thing and turned being a 30-something single woman into a badge of honor.

This year, SATC turns 20. Just in time for that milestone, Jennifer Keishin Armstrong’s new book “Sex and the City and Us,” looks at the show’s impact on television, feminism, fashion and, of course, sex.

Before diving into the show’s six-season evolution (1998-2004), Armstrong takes readers back to Carrie Bradshaw’s beginnings in the pages of the New York Observer. Journalist Candace Bushnell penned her “Sex and the City” column for the paper in the mid-’90s, chronicling the wild mating practices of the city’s elite. They were so wild, in fact, that she created her alter ego, Carrie, to mask her own escapades. Bushnell had a hit, and Armstrong details how she put the column turned book into the hands of veteran producer Darren Star.

Star envisioned “a modern, R-rated version of The Mary Tyler Moore Show — a series about sex and relationships from a female point of view.” There’s definitely a difference between Mary tossing her hat and Samantha tossing her pants, but HBO embraced that aesthetic from the get-go. On cable, there could be plenty of skin, but who would they hire to show that skin?

Armstrong goes deep into the casting, taking us through the surprisingly difficult process of getting the now-famous foursome on air. Sarah Jessica Parker had very cold feet, and convincing Kim Cattrall to play Samantha was even harder. HBO was ready for a character like clothing-optional Sam, but Cattrall wasn’t. At 42, she considered herself “over the hill.” For once, it was the entertainment industry that disagreed.

A character like Samantha was what “Sex and the City” was all about from the beginning, Armstrong explains: turning stereotypes of single women — especially single women over 30 — on their head. “Sex and the City transformed singledom from a drab Cathy comic strip into something enviable,” she writes. And millions of women agreed.

But that designer-clad vision was an exceedingly white one. While most of Armstrong’s book heaps praise on “SATC,” she does repeatedly call out its whitewashing. Not only were the four main characters white, but the world they existed in was, too. Armstrong reminds us that when the powers that be did add characters of color, they were stereotype-laden, such as Samantha’s hip-hop producer boyfriend who takes her to a club with a metal detector.

The writers and producers of the show are stars in this story as much as the actors, particularly the two at the helm: Star and Michael Patrick King. Armstrong details how these two gay men created a very feminine universe, eventually hiring a small army of young female screenwriters to help. Armstrong brings readers inside the writers’ room and into the scribes’ lives, which were all “up for analysis, processing, and distillation into a script.”

As the book moves to the final season, Armstrong looks at how the plotlines shifted from frothy — “Can women have sex like men?” — to serious, addressing issues such as cancer. But through it all, the author notes, what carried the show was the element of friendship. “These women love each other,”Armstrong writes.

The women certainly loved each other on screen, but what about off? That’s been a constant question, particularly the alleged feud between Cattrall and Parker. The book went to press before Cattrall called out Parker as “cruel” on Instagram in February, but the way Armstrong paints their relationship, Cattrall’s remark doesn’t come as a surprise.

The personal lives of the four actresses are largely left alone as the author focuses on interactions on the set, but she does describe how they dealt with the enormous media attention that comes with being on a hit series, particularly when Nixon left her boyfriend for a woman. (Having already endured that level of scrutiny should help Nixon keep her Zen now that she’s entered the New York gubernatorial race.)

Looking back on SATC so many years later, Star said, “After us, sex was seen differently. We made it pink. And fizzy. We took it into the light and made it something empowering, but also funny.” The same could be said for Armstrong’s book. The writing is fizzy and funny, but she still manages an in-depth look at a show that’s been analyzed for decades, giving readers a retrospective as enjoyable as a $20 pink cocktail.

Karin Tanabe, a former Politico reporter, is the author of four novels, including her latest, “The Diplomat’s Daughter.”

Read more:

Sex and the City and Us

How Four Single Women Changed the Way We Think, Live, and Love

By Jennifer Keishin Armstrong

Simon & Schuster. 232 pp. $26