A reactive power controller for controlling reactive power in a wind farm grid connected to a utility grid and comprising at least two sub-grids (300, 400, 500) and a collector portion, wherein at least two wind turbines (301,401,501) are connected to each sub-grid of the at least two sub-grids, wherein the at least two sub-grids are connected to the collector portion and wherein the collector portion establishes the connection to the utility grid, the reactive power controller comprising: at least one sub-grid measurement device (701, 702, 703) arranged at each sub grid, for measuring a reactive power component at each sub grid (300, 400, 500); at least one sub-grid controller (801, 802, 803) operatively connected to the at least one sub-grid measurement device (701, 702, 703) for controlling said at least two wind turbines (301, 401, 501) connected to the sub-grid on basis of the measured reactive power component at each sub-grid (300, 400, 500) such that a desired reactive power value is attained at each sub-grid; wherein the at least one sub-grid controller (801. 802, 803) is connected to individual wind turbine controllers of the wind turbines (301, 302. 303) connected to the sub-grid; a determination device for determining an actual reactive power value at the collector portion; and a wind farm controller operatively connected to the determination device for controlling at least one of the at least one sub-grid controller (801, 802, 803) on a basis of the determined actual reactive power value at the collector portion such that a desired reactive power value at the collector portion is attained; and wherein each sub-grid (300, 400, 500) includes an associated sub-grid transformer (321, 421, 521) used to transform the power generated by the individual sub-grids (300, 400, 500) from a media voltage to a high voltage range; and wherein the wind farm controller is used for controlling individual sub-grid controllers (801. 802. 803) which control respective wind turbines in the associated sub-grid (300, 400, 500), and wherein current and voltage measurements are performed by the sub-grid measurement devices at to measure reactive power components at each sub-grid side of the respective sub-grid transformers (321, 421, 521) and wherein the collector portion comprises a collector bar and a take-over point is provided between said at least two sub-grids (300,400,500) and said collector bar and a complete or partial compensation (Qcomp) of reactive power components near the take-over point at the collector bar is provided by the reactive power values attained at each sub grid. at least one sub-grid measurement device (701, 702, 703) arranged at each sub grid, for measuring a reactive power component at each sub grid (300, 400, 500); at least one sub-grid controller (801, 802, 803) operatively connected to the at least one sub-grid measurement device (701, 702, 703) for controlling said at least two wind turbines (301, 401, 501) connected to the sub-grid on basis of the measured reactive power component at each sub-grid (300, 400, 500) such that a desired reactive power value is attained at each sub-grid; wherein the at least one sub-grid controller (801. 802, 803) is connected to individual wind turbine controllers of the wind turbines (301, 302. 303) connected to the sub-grid; a determination device for determining an actual reactive power value at the collector portion; and a wind farm controller operatively connected to the determination device for controlling at least one of the at least one sub-grid controller (801, 802, 803) on a basis of the determined actual reactive power value at the collector portion such that a desired reactive power value at the collector portion is attained; and wherein each sub-grid (300, 400, 500) includes an associated sub-grid transformer (321, 421, 521) used to transform the power generated by the individual sub-grids (300, 400, 500) from a media voltage to a high voltage range; and wherein the wind farm controller is used for controlling individual sub-grid controllers (801. 802. 803) which control respective wind turbines in the associated sub-grid (300, 400, 500), and wherein current and voltage measurements are performed by the sub-grid measurement devices at to measure reactive power components at each sub-grid side of the respective sub-grid transformers (321, 421, 521) and wherein the collector portion comprises a collector bar and a take-over point is provided between said at least two sub-grids (300,400,500) and said collector bar and a complete or partial compensation (Qcomp) of reactive power components near the take-over point at the collector bar is provided by the reactive power values attained at each sub grid.