A pharmaceutical composition for treating melasma is provided. The pharmaceutical composition is prepared from ginseng, salvia, mint, orange peel, peony, poria, licorice, peach seed, yam, penthorum chinense and a fermentation conversion solution of fruits and vegetables. A preparation method of the pharmaceutical composition is also provided.