When fluids are confined in slit pores between parallel walls, their static structures and their dynamical properties exhibit inhomogeneity in the z‐direction perpendicular to the wall. Of particular interest are local bulk viscosity ηb(z) and shear viscosity ηs(z). Here, we discuss an algorithm to estimate these quantities from Green–Kubo relations using equilibrium molecular dynamics. As an application example, a polymer brush (macromolecules end‐grafted to a substrate at z = 0) interacting with a solvent formed from point‐like particles is given.