Abstract. Storing energy is a major challenge in achieving a 100 % renewable energy system. One promising approach is the production of green hydrogen from wind power. This work proposes a method for optimizing the design of wind–hydrogen systems for existing onshore wind farms in order to achieve the lowest possible levelized cost of hydrogen (LCoH). This is done by the application of a novel Python-based optimization model that iteratively determines the optimal electrolyzer position and distribution mode of hydrogen for given wind farm layouts. The model includes the costs of all required infrastructure components. It considers peripheral factors such as existing and new roads, necessary power cables and pipelines, wage and fuel costs for truck transportation, and the distance to the point of demand (POD). Based on the results, a decision can be made whether to distribute the hydrogen to the POD by truck or pipeline. For a 23.4 MW onshore wind farm in Germany, a minimal LCoH of EUR 4.58 kgH2-1 at an annual hydrogen production of 241.4 tH2a-1 is computed. These results are significantly affected by the position of the electrolyzer, the distribution mode, varying wind farm and electrolyzer sizes, and the distance to the POD. The influence of the ratio of electrolyzer power to wind farm power is also investigated. The ideal ratio between the rated power of the electrolyzer and the wind farm lies at around 10 %, with a resulting capacity factor of 78 % for the given case. The new model can be used by system planners and researchers to improve and accelerate the planning process for wind–hydrogen systems. Additionally, the economic efficiency, hence competitiveness, of wind–hydrogen systems is increased, which contributes to an urgently needed accelerated expansion of electrolyzers. The results of the influencing parameters on the LCoH will help to set development goals and indicate a path towards a cost-competitive green wind–hydrogen system.