Encapsulation is a technique that makes fields in a class private and provides access to them via public methods. This prevents code outside the class from randomly accessing fields. Encapsulation combines data and behaviors in a class, and allows only behaviors to access and modify the data, controlling its values. It hides how an object works internally, making only its behaviors visible. Encapsulation draws boundaries around data and methods, allowing developers to use code without knowing how it works. It makes code more maintainable, flexible, and extensible by allowing updates without changing input/output formats.