301 redirect is a permanent redirection. It informs search engines that the URL they’re trying to access has been changed permanently. When you delete pages or change URLs, they don’t disappear, and in order to avoid from receiving 404 errors, it is best practice to use a 301 redirect.
301 redirects will redirect users and search engines from these old URLs to new active pages that you specify. This also ensures avoid confusing users, and to pass on search results authority from these old pages to the ones.
And also, in cases that people who have linked to or bookmarked the old address will automatically get to the new one, and search engines can update their index.