The paper introduces the R package *mediation* for conducting causal mediation analysis in applied empirical research. The package implements a comprehensive suite of statistical tools for estimating causal mediation effects and conducting sensitivity analysis under both model-based and design-based approaches. The model-based approach relies on the sequential ignorability assumption, while the design-based approach does not require this assumption and is applicable under different experimental designs. The package also includes methods for dealing with multiple causally dependent mediators. The paper provides an overview of the package's functionalities, including estimation of average causal mediation effects, moderated mediation, non-binary treatment variables, and sensitivity analysis for sequential ignorability. Additionally, it discusses the analysis of multilevel data and design-based causal mediation analysis under single experiment designs. The package is freely available on CRAN and supports various statistical models, making it a valuable tool for researchers interested in understanding the causal mechanisms underlying their data.The paper introduces the R package *mediation* for conducting causal mediation analysis in applied empirical research. The package implements a comprehensive suite of statistical tools for estimating causal mediation effects and conducting sensitivity analysis under both model-based and design-based approaches. The model-based approach relies on the sequential ignorability assumption, while the design-based approach does not require this assumption and is applicable under different experimental designs. The package also includes methods for dealing with multiple causally dependent mediators. The paper provides an overview of the package's functionalities, including estimation of average causal mediation effects, moderated mediation, non-binary treatment variables, and sensitivity analysis for sequential ignorability. Additionally, it discusses the analysis of multilevel data and design-based causal mediation analysis under single experiment designs. The package is freely available on CRAN and supports various statistical models, making it a valuable tool for researchers interested in understanding the causal mechanisms underlying their data.