In order to increase the ratio of anti-HIV activity to anticoagulant activity, glycosaminoglycan derivatives selectively substituted at OH and/or COOH groups were prepared. Standard heparin, heparin fragments, or dermatan sulfate were converted to their tributylammonium or tetrabutylammonium salts. Their selective O-acylation to various (controlled) degrees was carried out in a homogeneous way in N,N-dimethylformamide using carboxylic acid anhydrides and 4-(dimethylamino)pyridine as catalyst. Esterification of the COOH groups was performed by the addition of alkyl halide to an N,N-dimethylformamide solution of glycosaminoglycan tetrabutylammonium salts. The in vitro anticoagulant activity, the activity against HIV-1 and HIV-2 cytopathicity, the cytotoxicity, and the activity on the induction of giant cell formation were determined. O-acylation (O-butyrylation or O-hexanoylation) of the heparin fragments obtained by periodate depolymerization (compounds 2d and 2e), and their esters (compounds 7i and 7j), yielded products with very low anticoagulant effects in vitro, yet potent activity against both HIV-1 and HIV-2 induced cytopathicity, and low, if any, cytotoxicity. As compared to other anionic polysaccharides, these acylated derivatives are more active as inhibitors of HIV-induced giant-cell formation. Their anti-HIV activity is related to the degree of O-acylation and is mainly due to the inhibition of virus adsorption to the target cells.