Despite steady improvements in the skill of numerical weather and climate models over the last decades, a longstanding issue is the development of biases after initialization. These biases (systematic forecast errors) cause degradation of performance for both medium range weather forecasting and subseasonal to decadal climate predictions. They arise from issues like limited resolution, inaccurate physical parameterizations, and imperfect initial conditions. Typically, postprocessing steps are developed to handle these biases such as model output statistics for weather forecasting (Glahn & Lowry, 1972) or ensemble bias correction for seasonal prediction (Arribas et al., 2011;Stockdale et al., 1988). In this study, we propose an online bias correction method using machine learning (ML). We apply a corrective tendency to the prognostic state of the atmospheric model at each time step in order to reduce atmospheric model error growth. The necessary corrective tendencies are estimated from a hindcast simulation which is linearly nudged towards an observational analysis. An ML model is trained to predict the nudging tendencies using only the state of the model as inputs. This ML model can then be used in a forecast to keep the model evolution on a more realistic manifold.