Nonequilibrium stationary states of thermodynamic systems dissipate a positive amount of energy per unit of time. If we consider transformations of such states that are realized by letting the driving depend on time, the amount of energy dissipated in an unbounded time window becomes then infinite. 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 performed along any given transformation. We then show that the renormalized work satisfies a Clausius inequality and prove that equality is achieved for very slow transformations, that is in the quasi static limit. We finally connect the renormalized work to the quasi potential of the macroscopic fluctuation theory, that gives the probability of fluctuations in the stationary nonequilibrium ensemble. A main goal of nonequilibrium thermodynamics is to construct analogues of thermodynamic potentials for nonequilibrium stationary states. These potentials should describe the typical macroscopic behavior of the system as well as the asymptotic probability of fluctuations. As it has been shown in [1], this program can be implemented without the explicit knowledge of the stationary ensemble and requires as input the macroscopic dynamical behavior of systems which can be characterized by the transport coefficients. This theory, now known as macroscopic fluctuation theory, is based on an extension of Einstein equilibrium fluctuation theory to stationary nonequilibrium states combined with a dynamical point of view. It has been very powerful in studying concrete microscopic models but can be used also as a phenomenological theory. It has led to several new interesting predictions [2][3][4][5][6][7].From a thermodynamic viewpoint, the analysis of transformations from one state to another one is most relevant. This issue has been addressed by several authors in different contexts. For instance, following the basic papers [8][9][10], the case of Hamiltonian systems with finitely many degrees of freedom has been recently discussed in [11,12] while the case of Langevin dynamics is considered in [13].We here consider thermodynamic transformations for driven diffusive systems in the framework of the macroscopic fluctuation theory. With respect to the authors mentioned above, the main difference is that we deal with systems with infinitely many degrees of freedom and the spatial structure becomes relevant. For simplicity of notation, we restrict to the case of a single conservation law, e.g., the conservation of the mass. We thus consider an open system in contact with boundary reservoirs, characterized by their chemical potential λ, and under the action of an external field E. We denote by Λ ⊂ R d the bounded region occupied by the system, by x the macroscopic space coordinates and by t the macroscopic time. With respect to our previous work [1, 3, 4], we here consider the case in which λ and E depend explicitly on the time t, driving the system from a nonequilibrium state to...