The acid is usually formed by acidification of an azide salt like sodium azide. Normally solutions of sodium azide in water contain trace quantities of hydrazoic acid in equilibrium with the azide salt, but introduction of a stronger acid can convert the primary species in solution to hydrazoic acid. The pure acid may be subsequently obtained by fractional distillation as an extremely explosive colorless liquid with an unpleasant smell.
Its aqueous solution can also be prepared by treatment of barium azide solution with dilute sulfuric acid, filtering the insoluble barium sulfate.
It was originally prepared by the reaction of aqueous hydrazine with nitrous acid:
With the hydrazinium cation  this reaction is written as:
Other oxidizing agents, such as hydrogen peroxide, nitrosyl chloride, trichloramine or nitric acid, can also be used to produce hydrazoic acid from hydrazine.