Refactoring involves restructuring existing code without changing its external behavior in order to improve aspects like readability, structure, and performance. It is done through a series of small, behavior-preserving changes. Refactoring can save time by improving code quality, allowing easier prototyping and changes when specifications are unclear, and helping to establish a clear overall project structure. It is important that refactoring does not break any existing functionality and keeps a consistent application programming interface.