Bacterial infections are a significant global health challenge because they can attack various body tissues and cause illnesses ranging from mild to severe. Staphylococcus epidermidis is a bacterium that often causes various infections. Infection by Staphylococcus epidermidis can slow down the wound healing process and carry the risk of serious complications if not properly managed. This study aims to formulate and optimise an antibacterial gel from the ethyl acetate fraction of purple sweet potato leaves (Ipomoea batatas L.) as a natural alternative for treating skin infections caused by the bacterium Staphylococcus epidermidis. Using the I-optimal mixture design method in Design-Expert software, the optimization analysis was performed by evaluating several responses, including pH, viscosity, spreadability, and adhesion of the gel formulation. The experimental data were fitted to an appropriate polynomial model and analyzed using ANOVA to determine the significance of the model and mixture components. Numerical optimization was then carried out by setting the desired criteria for each response to obtain the optimum formulation. The optimal formulation consisted of 2% HPMC and 13% propylene glycol, with a desirability value of 0.964. The results showed that this formulation met all the criteria for a good and stable gel, including organoleptic properties (semi-solid, brownish-green, characteristic odour, homogeneous), pH (5.81), viscosity (2316.52 cPs), spreadability (6.4 cm), and adhesion time (2.18 seconds). The optimal formulation for an antibacterial gel containing the ethyl acetate fraction of purple sweet potato leaves (Ipomoea batatas L.) was achieved using a 2% HPMC concentration and 13% propylene glycol, with a desirability value of 0.964, , this gel formulation is also effective and falls into the category of being highly potent in inhibiting the growth of Staphylococcus epidermidis, as evidenced by the formation of an inhibition zone of 23 mm.