Encapsulation is an object-oriented programming concept that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse. It hides the internal representation of an object from outside code by only allowing access through public methods. This allows for changes to the implementation of the methods and attributes without affecting the outside code. Encapsulation is achieved by setting data as private and providing public getters and setters to access and modify the private data.