How to change the format of thumbnails into wordpress theme?

dear community.
I have question about changing the format of thumbnail into WordPress theme.

I want to change all generated images format into a theme to *.webp. I already have generated *.webp images. Where I can do it into WordPress? Where I can change the format of generated thumbnails?

Best Regards