Attention has been paid to bioflocculants production because of their effectiveness, innocuousness and environmental friendliness. This study aimed to characterise a bioflocculant from Bacillus megaterium BMBF and apply it in wastewater treatment. The proteins, carbohydrates and uronic acid were calculated using the Bradford, phenol–sulphuric acid and carbazole assays, respectively. An energy-dispersive X-ray (EDX) and infrared spectrometry were employed for the identification of the elemental composition and effective units, respectively. Cytotoxicity was carried out against Vero (African green monkey kidney) and bovine dermis cells using a colorimetric cytotoxicity assay. The reduction in chemical oxygen demand (COD) and biological oxygen demand (BOD) in domestic and coal mine wastewater was studied using the Jar test. The flocculant was composed of 12% protein, 27% carbohydrates and 61% uronic acid. Infrared spectrometry indicated hydroxyl, carboxyl and amino groups. EDX indicated C (61%) and O (17.5%) as the main elements. The bioflocculant revealed the mean inhibition concentration of 59 ug/mL against bovine dermis and 240 µg/mL on Vero cells. Maximum COD and BOD removal percentages of 97% and 99.3% were recorded on coal mine wastewater treatment and about 99.2% (COD) and 93% (BOD) on domestic wastewater. In conclusion, the bioflocculant from B. megaterium has potential industrial utility.