Objective.In online adaptive radiotherapy a new plan is generated every fraction based on the organ and clinical target volume (CTV) delineations of that fraction. This allows for a planning target volume margin that does not need to be constant over the whole course of treatment, as is the case in conventional radiotherapy. This work aims to introduce an approach to update the margins each fraction based on the per-patient treatment history and explore the potential benefits of such adaptive margins.Approach.We introduce a novel methodology to implement adaptive margins, isotropic and anisotropic, during a treatment course based on the accumulated dose to the CTV. We then simulate treatment histories for treatments delivered in up to 20 fractions using various choices for the standard deviations of the systematic and random errors and homogeneous and inhomogeneous dose distributions. The treatment-averaged adaptive margin was compared to standard constant margins. The change in the minimum dose delivered to the CTV was compared on a patient and a population level. All simulations were performed within the van Herk approach and its known limitations.Main results.The population mean treatment-averaged margins are down to 70% and 55% of the corresponding necessary constant margins for the isotropic and anisotropic approach. The reduction increases with longer fractionation schemes and an inhomogeneous target dose distribution. Most of the benefit can be attributed to the elimination of the effective systematic error over the course of treatment. Interpatient differences in treatment-averaged margins were largest for the isotropic margins. For the 10% of patients that would receive a lower than prescribed dose to the CTV this minimum dose to the CTV is increased using the adaptive margin approaches.Significance.Adaptive margins can allow to reduce margins in most patients without compromising patients with greater than average target motion.