p
        
        
          K
          
            
              a
            
          
        
        =
      
    
    {\displaystyle \mathrm {p} K_{{\ce {a}}}=}
   4.61
Commercially available minoxidil topical solution should be stored at a temperature of 20-25 °C. Extemporaneous formulations of minoxidil have been reported to have variable stability, depending on the vehicle and method of preparation, and the FDA requests that physicians and pharmacists refrain from preparing extemporaneous topical formulations using commercially available minoxidil tablets. Minoxidil tablets should be stored in well-closed containers at 15-30 °C. Minoxidil, 6-amino-1,2-dihydro-1-hydroxy-2-imino-4-piperidinopyrimidine, is synthesized from barbituric acid, the reaction of which with phosphorous oxychloride gives 2,4,6-trichloropyrimidine. Upon reaction with ammonium, this turns into 2,4-diamino-6-chloropyrimidine. Next, the resulting 2,4-diamino-6-chloropyrimidine undergoes reaction with 2,4-dichlorophenol in the presence of potassium hydroxide, giving 2,4-diamino-6-(2,4-dichlorophenoxy)-pyrimidine.
Oxidation of this product with 3-chloroperbenzoic acid gives 2,4-diamino-6-(2,4-dichlorophenoxy)pyrimidine-3-oxide, the 2,4-dichlorophenoxyl group of which is replaced with a piperidine group at high temperature, giving minoxidil.Another synthesis approach is depicted here:

Compounds related to minoxidil include kopexil (diaminopyrimidine oxide). History
Initial application
Minoxidil was developed in the late 1950s by the Upjohn Company (later became part of Pfizer) to treat ulcers. In trials using dogs, the compound did not cure ulcers, but proved to be a powerful vasodilator. Upjohn synthesized over 200 variations of the compound, including the one it developed in 1963 and named minoxidil. These studies resulted in the U.S. Food and Drug Administration (FDA) approving minoxidil (with the brand name Loniten) in the form of oral tablets to treat high blood pressure in 1979. Hair growth
When Upjohn received permission from the U.S. Food and Drug Administration (FDA) to test the new drug as medicine for hypertension they approached Charles A. Chidsey MD, Associate Professor of Medicine at the University of Colorado School of Medicine. He conducted two studies, the second study showing unexpected hair growth. Puzzled by this side-effect, Chidsey consulted Guinter Kahn (who while a dermatology resident at the University of Miami had been the first to observe and report hair development on patients using the minoxidil patch) and discussed the possibility of using minoxidil  for treating hair loss. Kahn along with his colleague Paul J. Grant MD had obtained a certain amount of the drug and conducted their own research, since they were first to make the side effect observation.