The identification of molecules remains a central question in analytical chemistry, in particular for natural products research, untargeted metabolomics, etc. Mass spectrometry is a predominant experimental technique in these fields, but metabolite structural elucidation remains highly challenging. We report SIRIUS 4, a specialized tool that addresses two fundamental questions: What is the molecular formula of the query compound among all molecular formulas, both previously observed and unobserved? For both questions, SIRIUS 4 offers best-of-class performance; for searching in molecular structure databases, SIRIUS 4 integrates CSI:FingerID as a web service. In evaluation, the number of wrongly assigned molecular formulas decreased by 31.7% compared to SIRIUS 3.0. For structure elucidation, the CSI:FingerID web service achieved identification rates of 74% on challenging independent metabolomics datasets, searching in a biocompound structure database with 0.5 million structures. Finally, running times improved substantially (231- to 332-fold) to the previous version. To this end, Users can now analyze full full liquid chromatography-mass spectrometry (LC-MS) datasets, rather than just one spectrum at a time; MS-driven annotations can be obtained for all detected features, not just those passing a preliminary statistical test, say, on fold change.