His wife, Susan Schneider, said in a statement, “This morning, I lost my husband and my best friend, while the world lost one of its most beloved artists and beautiful human beings.” She added: “As he is remembered, it is our hope the focus will not be on Robin’s death, but on the countless moments of joy and laughter he gave to millions.”

The privileged son of a Detroit auto executive who grew up chubby and lonesome, playing by himself with 2,000 toy soldiers in an empty room of a suburban mansion, Mr. Williams, as a boy, hardly fit the stereotype of someone who would grow to become a brainy comedian, or a goofy one, but he was both. Onstage he was known for ricochet riffs on politics, social issues and cultural matters both high and low; tales of drug and alcohol abuse; lewd commentaries on relations between the sexes; and lightning-like improvisations on anything an audience member might toss at him. His gigs were always rife with frenetic, spot-on impersonations that included Hollywood stars, presidents, princes, prime ministers, popes and anonymous citizens of the world. His irreverence was legendary and uncurtailable.

“Chuck, Cam, great to see you,” he once called out from a London stage at Charles, Prince of Wales, and his wife, Camilla, Duchess of Cornwall. “Yo yo, wussup Wales, House of Windsor, keepin’ it real!”

And yet he never seemed to offend.

Almost from the moment that he first uttered the greeting “Nanoo, nanoo” as Mork from Ork, an alien who befriends a wholesome young Colorado woman (Pam Dawber), on the sitcom “Mork and Mindy,” Mr. Williams was a comedy celebrity. “Mork and Mindy” made its debut on ABC in September 1978, and within two weeks had reached No. 7 in the Nielsen ratings. By the spring of 1979, 60 million viewers were tuning in to “Mork and Mindy” each week to watch Mr. Williams drink water through his finger, stand on his head when told to sit down, speak gibberish words like “shazbot” and “nimnul” that came to have meaning when he used them, and misinterpret, in startlingly literal fashion, the ordinary idioms of modern life.