A machine for filling cartridges for aerosol-generating devices, wherein: each cartridge comprises an end with an open area where access to the inside of the cartridge is allowed and an at least partially occluded area where access to the inside of the cartridge is prevented, the cartridge having an axis of longitudinal development that passes through said end; the filling machine comprising: - a feed line, which supplies cartridges to be filled with their corresponding ends facing upwards; and - a filling station, which receives the cartridges to be filled and comprises at least one dispensing nozzle, which is mobile along a path of forward stroke and is pre-arranged for dispensing a product; said machine being characterized in that it comprises: - first inspection means configured for inspecting the ends of the cartridges to be filled in order to identify, for each one, the position of the corresponding open area; and - an orientation station, which receives the cartridges to be filled that have been inspected; the orientation station comprises orientation means, configured for rotating each cartridge about its own longitudinal axis, on the basis of the corresponding identified position, bringing the open area into a position corresponding to a pre-set reference position, for enabling entry of the dispensing nozzle into the open area of the cartridge when the dispensing nozzle is driven along the path of forward stroke. the filling machine comprising: - a feed line, which supplies cartridges to be filled with their corresponding ends facing upwards; and - a filling station, which receives the cartridges to be filled and comprises at least one dispensing nozzle, which is mobile along a path of forward stroke and is pre-arranged for dispensing a product; - a feed line, which supplies cartridges to be filled with their corresponding ends facing upwards; and - a filling station, which receives the cartridges to be filled and comprises at least one dispensing nozzle, which is mobile along a path of forward stroke and is pre-arranged for dispensing a product; said machine being characterized in that it comprises: - first inspection means configured for inspecting the ends of the cartridges to be filled in order to identify, for each one, the position of the corresponding open area; and - an orientation station, which receives the cartridges to be filled that have been inspected; the orientation station comprises orientation means, configured for rotating each cartridge about its own longitudinal axis, on the basis of the corresponding identified position, bringing the open area into a position corresponding to a pre-set reference position, for enabling entry of the dispensing nozzle into the open area of the cartridge when the dispensing nozzle is driven along the path of forward stroke. - first inspection means configured for inspecting the ends of the cartridges to be filled in order to identify, for each one, the position of the corresponding open area; and - an orientation station, which receives the cartridges to be filled that have been inspected; the orientation station comprises orientation means, configured for rotating each cartridge about its own longitudinal axis, on the basis of the corresponding identified position, bringing the open area into a position corresponding to a pre-set reference position, for enabling entry of the dispensing nozzle into the open area of the cartridge when the dispensing nozzle is driven along the path of forward stroke.