This paper focuses on developing an algorithm that can generate toolpaths in NURBS form for smooth, high speed and accurate machining. The initial toolpaths are obtained by tool radius compensation method which is based on the workpiece boundary offsetting. According to different lengths and the continuous short block (CSB) criterion, these offset linear segments can be regarded as CSBs or long straight segments. Junctions are located where the curvature value is greater than the preset curvature threshold value or where it changes abruptly, or at the two end points of any long straight segment. During machining, the NURBS fitting module first looks ahead several CSBs and converts them into parametric curves in real time. During the conversion, continuities of the position, slope or even curvature at the transition of the parametric curves and unfitted line segments can be guaranteed. Then the acceleration/deceleration feedrate-planning scheme is proposed to determine the transition feedrate at the junction between the fitted curves and unfitted long straight segments, and the corner feedrate within the fitted curve. Simulations and experiments show that the proposed algorithm can significantly improve machining accuracy and reduce cutting time to satisfy today's high-speed and high-accurate machining requirements.