Mass spectrometry is commonly applied to qualitatively and quantitatively profile small molecules, such as peptides, metabolites, or lipids. Modern mass spectrometers provide accurate measurements of mass-to-charge ratios of ions, with errors as low as 1 ppm. Even such high mass accuracy, however, is not sufficient to determine the unique chemical formula of each ion, and additional algorithms are necessary. Here we present a universal software tool for predicting chemical formulas from high-resolution mass spectrometry data, developed within the MZmine 2 framework. The tool is based on the use of a combination of heuristic techniques, including MS/MS fragmentation analysis and isotope pattern matching. The performance of the tool was evaluated using a real metabolomic data set obtained with the Orbitrap MS detector. The true formula was correctly determined as the highest-ranking candidate for 79% of the tested compounds. The novel isotope pattern-scoring algorithm outperformed a previously published method in 64% of the tested Orbitrap spectra. The software described in this manuscript is freely available and its source code can be accessed within the MZmine 2 source code repository.