The phrase 'mad as a hatter' is an idiomatic expression used to describe someone who is completely insane or eccentric. This expression is often linked to the historical practice of hat-making, where the use of mercury in the process caused serious neurological damage, leading to erratic behavior among workers. The phrase gained popularity through literature, most notably in Lewis Carroll's 'Alice's Adventures in Wonderland,' where the character of the Mad Hatter epitomizes whimsical madness.