Replacing petroleum feedstocks by biomass requires efficient methods to convert carbohydrates to a variety of chemical compounds. We report the catalytic conversion of sugars giving high yield to 5-hydroxymethylfurfural (HMF), a versatile intermediate. Metal halides in 1-alkyl-3-methylimidazolium chloride are catalysts, among which chromium (II) chloride is found to be uniquely effective, leading to the conversion of glucose to HMF with a yield near 70%. A wide range of metal halides is found to catalyze the conversion of fructose to HMF. Only a negligible amount of levulinic acid is formed in these reactions.