Objective To fabricate in situ crosslinking hyaluronic acid hydrogel and evaluate its biocompatibility in vitro. Methods The acrylic acid chloride and polyethylene glycol were added to prepare crosslinking agent polyethylene glycol acrylate (PEGDA), and the molecular structure of PEGDA was analyzed by Flourier transformation infrared spectroscopy and 1H nuclear magnetic resonance spectroscopy. Hyaluronic acid hydrogel was chemically modified to prepare hyaluronic acid thiolation (HA-SH). And the degree of HA-SH was analyzed qualitatively and quantitatively by Ellman method. HA-SH solution in concentrations (W/V) of 0.5%, 1.0%, and 1.5% and PEGDA solution in concentrations (W/V) of 2%, 4%, and 6% were prepared with PBS. The two solutions were mixed in different ratios, and in situ crosslinking hyaluronic acid hydrogel was obtained; the crosslinking time was recorded. The cellular toxicity of in situ crosslinking hyaluronic acid hydrogel (1.5% HA-SH and 4% PEGDA mixed) was tested by L929 cells. Meanwhile, the biocompatibility of hydrogel was tested by co-cultured with human bone mesenchymal stem cells (hBMSCs). Results Flourier transformation infrared spectroscopy showed that most hydroxyl groups were replaced by acrylate groups; 1H nuclear magnetic resonance spectroscopy showed 3 characteristic peaks of hydrogen representing acrylate and olefinic bond at 5-7 ppm. The thiolation yield of HA-SH was 65.4%. In situ crosslinking time of hyaluronic acid hydrogel was 2 to 70 minutes in the PEGDA concentrations of 2%-6% and HA-SH concentrations of 0.5%-1.5%. The hyaluronic acid hydrogel appeared to be transparent. The toxicity grade of leaching solution of hydrogel was grade 1. hBMSCs grew well and distributed evenly in hydrogel with a very high viability. Conclusion In situ crosslinking hyaluronic acid hydrogel has low cytotoxicity, good biocompatibility, and controllable crosslinking time, so it could be used as a potential tissue engineered scaffold or repairing material for tissue regeneration.