PoreFlow: A complex pore-network model for simulation of reactive transport in variably saturated porous media. This study introduces PoreFlow, a pore-network modeling tool capable of simulating fluid flow and multi-component reactive and adsorptive transport under saturated and variably saturated conditions. PoreFlow includes a variety of modules, such as: pore network generator, drainage simulator, calculation of pressure and velocity distributions, and modeling of reactive solute transport accounting for advection and diffusion. The pore space is represented using a multi-directional pore-network capable of capturing the random structure of a given porous media with user-defined directional connectivities for anisotropic pore structures. The chemical reactions can occur within the liquid phase, as well as between the liquid and solid phases which may result in an evolution of porosity and permeability. Under variably saturated conditions the area of interfaces changes with degree of the fluid saturation. PoreFlow uses complex formulations for more accurate modeling of transport problems in presence of the nonwetting phase. This is done by refining the discretization within drained pores. An implicit numerical scheme is used to solve the governing equations, and an efficient substitution method is applied to considerably minimize computational times. Several examples are provided, under saturated and variably saturated conditions, to demonstrate the model applicability in hydrogeology problems and petroleum fields. We show that PoreFlow is a powerful tool for upscaling of flow and transport in porous media, utilizing different pore scale information such as various interfaces, phase distributions and local fluxes and concentrations to determine macro scale properties such as average saturation, relative permeability, solute dispersivity, adsorption coefficients, effective diffusion and tortuosity. Such information can be used as constitutive relations within continuum scale governing equations to model physical and chemical processes more accurately at the larger scales.