Flash messages in Rails help show temporary messages to users. When a controller action runs, it can set a flash message using flash[:notice] or flash[:alert]. If the action redirects, the flash message is stored and shown on the next page. After the message is displayed, Rails clears it automatically so it doesn't show again. If the action renders a view directly, flash.now can be used to show a message immediately without waiting for a redirect. This way, flash messages provide friendly feedback like 'Post created!' or 'Error saving post' that appear once and then disappear.