The present invention provides a method of producing a heparan sulfate having an anticoagulant activity. Specifically, the present invention provides the method of producing a heparan sulfate having a desired molecular weight, by partially N-deacetylating a heparosan followed by depolymerizing the heparosan by heparinase III, and converting the produced low molecular weight product into heparan sulfate having an anticoagulant activity.