The invention discloses a preservative-free ophthalmic in-situ gelling agent and a preparation method thereof. The preservative-free ophthalmic in-situ gelling agent comprises Carbomer, chitosan, lubricant, stabilizer, thickener, antioxidant, acetic acid, pH regulator, osmoregulator and de-ionized water. By using the Carbomer and chitosan as base materials for the preparation of the in-situ gelling agent, the in-situ gelling agent increases the solubility of the medicament, improves the absorption and bioavailability of the medicament, reduces the frequency of use and enhances the safety and efficiency; by containing the chitosan, the in-situ gelling agent has biological adhesive action, so that the adhesion of medicament particles onto the cornea is enhanced; and the in-situ gelling agent is free of preservative, thereby having no stimulus or damage to the corneal epithelium. The preservative-free ophthalmic in-situ gelling agent can be used as artificial tear for treating xerophthalmia, and can be also used as an administration and transmission system of ophthalmic medicaments.