Herpesviruses exemplified by herpes simplex virus-1 (HSV-1) attach to cell surface heparan sulfate (HS) for entry into host cells. However, during a productive infection, the HS moieties on parent cells can trap newly exiting viral progenies and inhibit their release. Here we demonstrate that a HS-degrading enzyme of the host, heparanase (HPSE), is upregulated through NF-kB and translocated to the cell surface upon HSV-1 infection for the removal of HS to facilitate viral release. We also find a significant increase in HPSE release in vivo during infection of murine corneas and that knockdown of HPSE in vivo inhibits virus shedding. Overall, we propose that HPSE acts as a molecular switch for turning a virus-permissive 'attachment mode' of host cells to a virus-deterring 'detachment mode'. Since many human viruses use HS as an attachment receptor, the HPSE-HS interplay may delineate a common mechanism for virus release.