Stephen Colbert stood in front of his live studio audience — his last for the foreseeable future — and told jokes for roughly 10 minutes about what’s on everyone’s mind.

“This coronavirus … it’s making people nervous,” he said Wednesday. “It’s making people anxious. But I think at a time like this we all need to laugh, to be together,” and then backing away, “from a distance of about 20 feet.”

In between blaring headlines about schools shutting their doors, the NBA suspending its season and frantic questions about the future, regular people are turning to the most human of ways to cope: humor.

Network late-night hosts this week devoted entire monologues to the novel coronavirus, “which, as you know was started by Netflix to get more people to watch more of their television,” Jimmy Kimmel quipped Wednesday night. Governments and comedians around the world are making funny public-service announcements about hygiene. Teens are creating dark TikToks about ignoring impending doom. Twitter is full of jokes about the new meaning of “cancel culture.”

“The greatest love affair is between my hand and my face,” joked Samhita Mukhopadhyay, executive editor of Teen Vogue. “They refuse to be apart. They long for each other’s company, only happy when cradling each other.”

It’s common for people to laugh at terrifying subject matter. Jokes often attempt to take something scary and make it seem harmless, said Peter McGraw, director of the Humor Research Laboratory at the University of Colorado at Boulder. That transformation lightens the mood and strengthens people’s ability to cope.

They’re making jokes to not panic even “as they buy 48 rolls of toilet paper and engage in a tug-of-war for the last package of waters,” McGraw said.

But how can you create resonate humor about a pandemic when actual people are sick and dying? Stand-up comedian and writer Guy Branum called it a delicate balance.

“There is this tension in society that needs to be dealt with, and humor’s value is its capacity to give us a sense of control and relief abut the things we can’t control and we’re scared of,” he said. “But at the same time, you don’t want to be gross, and you don’t want to be laughing at people or ridiculing the suffering of people just to congratulate yourself on not experiencing that.”

Much of the humor is centered on our changing daily habits — the same kind of communal behavior that comedians mine for observational jokes.

“You don’t really cover the dying part of it” said comedian and “Conan” writer Laurie Kilmartin. “The easiest way in is to cover the inconvenience” for those who aren’t most vulnerable.

With the coronavirus, McGraw said humor that targets ourselves, hapless governments or overreacting corporations is more likely to land than comedy about victims. But the further you perceive yourself to be from a crisis, the more likely you are to find this all funny, he added. A young and healthy person may laugh at a joke about the virus, but an older person who faces a serious risk from it probably won’t join in.

It also matters who’s making the joke, said Steven Thrasher, a Northwestern University professor and scholar of HIV/AIDS.

The LGBTQ community responded to the threat the HIV/AIDS epidemic posed to their lives, in part, with camp humor. President Ronald Reagan’s deputy press secretary making quips about the outbreak is now widely slammed as homophobic and indicative of the administration’s indifference to the crisis, Thrasher said.

“I think a lot of the impetus to make jokes right now is so many people feel at risk,” he said. “And parts of the population that usually don’t feel at risk suddenly feel at risk.”

At the dawn of the HIV/AIDS crisis, plenty of straight comedians told jokes with stereotypes or false information or targeted the most vulnerable with unoriginal, hack punchlines.

“In the 80′s there were a LOT of dudes who opened their sets, touch someone’s drink and say ‘I have AIDS & now you do,’ ” comedian Jackie Kashian tweeted. “Please don’t be the coronavirus version of that.”

With the coronavirus “there are also a lot of people who make jokes that are deeply rooted in the worst kind of racial stereotypes about the places more affected than the United States, which just contributes to xenophobia,” Branum said.

Some of the gallows humor is reminiscent of the memes and jokes about “World War III,” when tensions between the United States and Iran dramatically escalated in January. And in Iran, which weeks ago became an epicenter of the coronavirus infection in the Middle East, people have been forwarding grim jokes on WhatsApp. “If coronavirus doesn’t kill me, being stuck in the house with my husband for three weeks will,” one of them reads.

The United States has been gripped by widespread anxiety before, and comedians felt an almost patriotic duty to provide catharsis to a reeling public. The Onion published its post-9/11 issue with headlines such as “God Angrily Clarifies ‘Don’t Kill Rule’ ” and “Not Knowing What Else to Do, Woman Bakes American Flag Cake.”

Then-New York Mayor Rudolph W. Giuliani appeared on “Saturday Night Live,” imploring the show to continue. “Can we be funny?” producer Lorne Michaels asked. “Why start now?” he responded.

Humor in the aftermath of Sept. 11, 2001, was difficult to pull off, but it’s become easy to poke fun at how we’ve adjusted our lives in its wake.

“Right after 9/11, everyone was freaked out, and now it’s all TSA jokes and taking off your shoes,” Kilmartin said. “It’s like background noise. Coronavirus, too, once we all get used to doing all the things we need to keep it from spreading, will be a pain in the [butt] thing that we all have to deal with.”

Coronavirus jokes on TV are naturally less dark than what’s being said in comedy clubs, where comedians push into edgier takes while gauging audience reaction and pull back if they’ve gone too far. “In late-night, you have to be a little more cautious because you can’t hear your entire audience,” Kilmartin said.

Many comedians will argue no topic is off-limits, as long as you’re not telling mindless jokes. “If you are telling a joke that’s interesting and human, you can talk about anything, but a lot of people don’t put that work into it,” Branum said.

Kilmartin is still getting on planes and performing in comedy clubs. She brings microphone foam covers and has a coronavirus joke “about how I don’t want to get it from the club or a male comic because it’ll be even more viral, which is why I’d rather get it off the streets.”

Branum said his fellow comics are looking at the upside of quarantines: “That’s the great thing about coronavirus, I love stews. It’s such an opportunity to slow-cook things.”

He’s also never heard so many hand-washing jokes in his life.

“My question is, are we supposed to be singing ‘Happy Birthday’ to the virus,” he said, “or to our hands?”

Clarification: An earlier version of this story used the phrase “during the HIV/AIDS crisis.” Since the World Health Organization takes the position that the crisis is not over, the phrase has been changed to “at the dawn of the HIV/AIDS crisis.”