Methylene blue has been described as "the first fully synthetic drug used in medicine." Methylene blue was first prepared in 1876 by German chemist Heinrich Caro.
Its use in the treatment of malaria was pioneered by Paul Guttmann and Paul Ehrlich in 1891. During this period before the first World War, researchers like Ehrlich believed that drugs and dyes worked in the same way, by preferentially staining pathogens and possibly harming them. Changing the cell membrane of pathogens is in fact how various drugs work, so the theory was partially correct although far from complete. Methylene blue continued to be used in the second World War, where it was not well liked by soldiers, who observed, "Even at the loo, we see, we pee, navy blue."  Antimalarial use of the drug has recently been revived. It was discovered to be an antidote to carbon monoxide poisoning and cyanide poisoning in 1933 by Matilda Brooks.
The blue urine was used to monitor psychiatric patients compliance with medication regimes. This led to interest - from the 1890s to the present day - in the drugs antidepressant and other psychotropic effects. It became the lead compound in research leading to the discovery of chlorpromazine.