Abstract Robots that work in a proper formation show several advantages compared to a single complex robot, such as a reduced cost, robustness, efficiency and improved performance. Existing researches focused on the method of keeping the formation shape during the motion, but usually neglect collision constraints or assume a simplified model of obstacles. This paper investigates the path planning of forming a target robot formation in a clutter environment containing unknown obstacles. The contribution lies in proposing an efficient path planner for the multiple mobile robots to achieve their goals through the clutter environment and developing a dynamic priority strategy for cooperation of robots in forming the target formation. A multirobot system is set up to verify the proposed method of robot path planning. Simulations and experiments results demonstrate that the proposed method can successfully address the collision avoidance problem as well as the formation forming problem.