The stability of anthocyanins is greatly affected by pH and temperature, and thus their application in food products is limited. This study was aimed to develop an antibacterial food colorant using anthocyanin from Clitoria ternatea flowers by applying microencapsulation technology. Maltodextrin was used as a carrier agent in the spray drying process. The anthocyanin microcapsule was durable to the light exposure up to 21 days, and the best color stability was observed between the temperature range of − 20 °C to 4 °C. However, the color was sustained with approximately 50% of the stability index after 1 day exposure at 80 °C and 180 °C. On disk diffusion assay, the anthocyanin microcapsule manifested a broad-spectrum antibacterial activity against Gram-bacteria. According to minimal inhibitory concentration (MIC) and minimal bactericidal concentration (MBC) assay, anthocyanin microcapsule exhibited bactericidal activity on all test bacteria, with the lowest MIC and MBC observed on Escherichia coli. The application of anthocyanin microcapsule on muffins has shown a significant inhibitory activity on foodborne bacteria. This study revealed the potential of C. ternatea anthocyanin microcapsule as a bio-preservative, which can prolong the shelf life of baked food products. [ABSTRACT FROM AUTHOR]