This paper aims to automate the detection of cancer using digital image processing techniques in MATLAB software. The analysis of white blood cells (WBC) is a powerful diagnostic tool for the prediction of Leukemia. The automatic detection of leukemia is a challenging task, which remains an unresolved problem in the medical imaging field. This Automation in Biological laboratories can be done by extracting the features of the blood film images taken from the digital microscopes and processed using MATLAB software. The aim of this approach is to discover the WBC cancer cells in an earlier stage and to reduce the discrepancies in diagnosis, by improving the system learning methodology. This paper presents the potent algorithm, which will eliminate the dubiety, in diagnosing the cancers with similar symptoms. This Algorithm concentrates on major WBC cancers, such as Acute Lymphocytic Leukemia, Acute Myeloid Leukemia, Chronic Lymphocytic Leukemia and Chronic Myeloid Leukemia. As they are life threatening diseases, rapid and precise differentiation is necessary in clinical settings. These cancers are categorized by segmentation and feature extraction, which will be further, classified using Random forest classification (RFC). RFC will classify the cancer using a decision tree learning method, which uses predictors at each node to make better decision.