Natamycin (NT) is a synthetic broad-spectrum antifungal used in eye drops. However, it has low solubility and high molecular weight, limiting its permeation, and generally causes eye discomfort or irritation when administered. Therefore, the present study aimed to develop an ophthalmic
in situ
gel formulation with NT-loaded cubosomes to enhance ocular permeation, improve antifungal activity, and prolong the retention time within the eye. The NT-loaded cubosome (NT-Cub) formula was first optimized using an I-optimal design utilizing phytantriol, PolyMulse, and NT as the independent formulation factors and particle size, entrapment efficiency %, and inhibition zone as responses. Phytantriol was found to increase particle size and entrapment efficiency %. Higher levels of PolyMulse slightly increased the inhibition zone whereas a decrease in particle size and EE% was observed. Increasing the NT level initially increased the entrapment efficiency % and inhibition zone. The optimized NT-Cub formulation was converted into an
in situ
gel system using 1.5% Carbopol 934. The optimum formula showed a pH-sensitive increase in viscosity, favoring prolonged retention in the eye. The
in vitro
release of NT was found to be 71 ± 4% in simulated tear fluid. The optimum formulation enhanced the
ex vivo
permeation of NT by 3.3 times compared to a commercial formulation and 5.2 times compared to the NT suspension. The
in vivo
ocular irritation test proved that the optimum formulation is less irritating than a commercial formulation of NT. This further implies that the developed formulation produces less ocular irritation and can reduce the required frequency of administration.