Flavor observables are usually computed with the help of the electroweak Hamiltonian which separates the perturbative from the non-perturbative regime. The Wilson coefficients are calculated perturbatively, while matrix elements of the operators require non-perturbative treatment, e.g. through lattice simulations. The resulting necessity to compute the transformation between the different renormalization schemes in the two calculations constitutes an important source of uncertainties. An elegant solution to this problem is provided by the gradient flow formalism because its composite operators do not require renormalization. In this talk we report on the construction of the electroweak Hamiltonian in the gradient flow formalism through NNLO in QCD.