Service workers are JavaScript files that allow web applications to work offline by caching resources and responding with cached resources when there is no internet connection. Service workers intercept network requests and can handle them, such as by serving cached responses, even when the user is offline. They run separately from the main browser thread and have access to the Fetch API but not the DOM. Service workers help build progressive web apps that are reliable, fast and engaging for users by allowing work offline.