(CNN) It's been a bad week for American comedians, who, in an attempt to be funny and push the envelope, wound up missing the mark and sparking a torrent of public outcry.

The week started with Kathy Griffin and a severed head, and ended with Bill Maher and a word too offensive to print.

For comedians, what defines "too far" -- and, more importantly, the optics around it -- can land them in hot water or even end their careers.

Griffin and Maher are not the first comedians to push the envelope or cross a line. But in the age of social media, when a joke lands flat or goes too far, the outcry can spread like wildfire.

Bill Maher and the N-word

JUST WATCHED Bill Maher under fire for using racial slur Replay More Videos ... MUST WATCH Bill Maher under fire for using racial slur 01:34

Maher, an outspoken and often crass comedian, used the N-word in an interview Friday night with Republican Sen. Ben Sasse of Nebraska, sparking immediate outrage on social media.

The two men were on Maher's HBO show, "Real Time with Bill Maher," discussing teenagers in Nebraska when Sasse invited Maher to visit.

"I've got to get to Nebraska more," Maher said.

"You're welcome. We'd love to have you work in the fields with us," the senator replied.

"Work in the fields?" Maher said, pausing, shaking his head and adding "Senator, I'm a house n****r."

Some audience members groaned while others laughed. Sasse kept quiet.

"No, it's a joke," Maher said, breaking the silence.

The two then went on to talk about other things.

Tweets soon poured in condemning Maher's remarks. Some called for his firing.

In an email to CNN, Quentin Schaffer, executive vice president for corporate communications at HBO, acknowledged that Maher's use of the N-word "was completely inexcusable and tasteless" and said it would be removed from future airings of the episode.

Maher released a statement through his publicist Saturday apologizing for the incident.

"I regret the word I used in the banter of a live moment. The word was offensive and I regret saying it and am very sorry. "

Sasse, in a series of tweets early Saturday, apologized for not standing up to Maher.

"Here's what I wish I'd been quick enough to say in the moment: 'Hold up, why would you think it's OK to use that word?' ... The history of the n-word is an attack on universal human dignity. It's therefore an attack on the American Creed. Don't use it."

Maher has bounced back from other controversies before.

In February, the comedian was criticized for appearing to bond with conservative firebrand Milo Yiannopoulos during his appearance on the HBO show.

Maher also has come under fire for his comments on religion, particularly his views on Islam

In 2002, Maher lost his ABC show, "Politically Incorrect," after his remarks about the September 11 attacks.

"We have been the cowards, lobbing cruise missiles from 2,000 miles away. That's cowardly," Maher said during a discussion about terrorism. "Staying in the airplane when it hits the building, say what you want about it, it's not cowardly."

Kathy Griffin and the severed head

JUST WATCHED Kathy Griffin in tears: Trump broke me Replay More Videos ... MUST WATCH Kathy Griffin in tears: Trump broke me 01:35

Griffin has been battling all week to survive the public beating she's taken after images were released showing her holding up a bloody head resembling that of President Donald Trump.

The comedian says she's endured abuse and "death threats" since the images were published.

In a news conference Friday, Griffin's attorney, Lisa Bloom, accused Trump and his family of "using their power to target her."

"As a result of the first family bullying her, she has been vilified, getting death threats, fired from multiple jobs and had multiple events canceled," Bloom said.

CNN fired Griffin from her gig on CNN's New Year's Eve program, which she had co-hosted with Anderson Cooper since 2007, amid the outcry.

Griffin apologized for the "disturbing" photos, taken by provocative celebrity photographer Tyler Shields, hours after the they were released.

"I beg for your forgiveness. I went too far," she said in a video posted to Instagram late Tuesday. "I made a mistake and I was wrong."

Griffin lost an endorsement deal with Squatty Potty, a line of bathroom footstools, and has had at least five of her stand-up gigs canceled since the photos were released.

Griffin, too, has endured her fair share of controversy in the past.

In 2007, she had to apologize after she joked about Jesus during an Emmy acceptance speech for her reality TV show "My Life on the D-List." In 2005 she was fired from the cable network E! for making a joke about Dakota Fanning, who was 10 at the time, entering rehab.

In both of those occasions, and in countless others, Griffin seems to have bounced back with even more steam than before.

Surviving controversy

When looking at the history of comedy, it seems that most comedians have had to apologize at one time or another for a joke that went too far. Some might argue that going too far is what makes some comedians better, or funnier, than others. However, it doesn't always end well for the comedian.

Comedian Michael Richards -- most widely known as Kramer from "Seinfeld" -- went on a racially charged tirade during a 2006 standup set, using the N-word several times to describe a group of men in the audience. Richards subsequently apologized several times, but his career could never recover from the incident. He has since retired from comedy and largely disappeared from the public eye.

Dane Cook's career took a big tumble in 2012 after the comedian made a joke about the shooting at a Aurora, Colorado, movie theater during the screening of "The Dark Knight Rises." He quickly apologized, saying he regretted "making a joke at such a sensitive time." Since the incident, Cook's career has hardly recovered.

Jackie Mason's career was almost cut short because of a controversy that wasn't. While appearing on the Ed Sullivan show in 1964 , Sullivan used two fingers to signal to Mason that he had two minutes left in his standup act. Mason began making gestures back at Sullivan. Sullivan believed Mason had given him the middle finger and banned him from the show.

Sullivan had such an impact on culture that Mason's career took a big hit, and it took many years before it fully recovered.

Others comedians have been luckier in controversy.

Louis C.K. shocked many viewers in 2015 with his opening monologue on the season finale of "Saturday Night Live." During his set he talked about his "mild racism" and the tenacity of child molesters.

The audience, and much of social media, seemed split in their reaction. Many viewers felt it was offensive, but the comedian's career barely faltered. He continues to do well, even coming back to host "SNL" in 2017.