We consider a macroscopic system in contact with boundary reservoirs and/or under the action of an external field. We discuss the case in which the external forcing depends explicitly on time and drives the system from a nonequilibrium state to another one. In this case the amount of energy dissipated along the transformation becomes infinite when an unbounded time window is considered. Following the general proposal by Oono and Paniconi and using results of the macroscopic fluctuation theory, we give a natural definition of a renormalized work. We then discuss its thermodynamic relevance by showing that it satisfies a Clausius inequality and that quasi static transformations minimize the renormalized work. In addition, we connect the renormalized work to the quasi potential describing the fluctuations in the stationary nonequilibrium ensemble. The latter result provides a characterization of the quasi potential that does not involve rare fluctuations.