In this paper, a clustering method using dictionary learning is proposed to group large medical databases. An approach grouping similar images into clusters that are sparsely represented by the dictionaries and learning dictionaries simultaneously via K-SVD is proposed. A query image is matched with the existing dictionaries to identify the dictionary with the sparsest representation using an Orthogonal Matching Pursuit (OMP) algorithm. Then images in the cluster associated with this dictionary are compared using a similarity measure to retrieve images similar to the query image. The main features of the method are that it requires no training data and works well on the medical databases which are not restricted to specific context. The performance of the proposed method is examined on IRMA test image database. The experimental results demonstrate the efficacy of the proposed method in the retrieval of medical images. © 2015 Elsevier B.V.