A device and method are provided for forming a knot to elongated material. The device includes a body, a central cavity inside the body, a material track along which the elongated material is guided in the device, the material track including an opening extending along the material track and open to the central cavity. The device further includes one or more barrier elements for blocking at least part of the opening for preventing the elongated material from escaping from the material track also prevents collapsing/folding of the material to the central cavity via the opening.