The HTML <samp> tag
The HTML <samp> element represents sample output from a computer program or system — an error message, console output — typically shown in a monospace font. It is distinct from <code> (source code) and <kbd> (user input).
Overview
The <samp> element marks text that is quoted output from a program or computer system — what a terminal prints, an error message, a status line, or any sample of machine-generated output. Browsers render it in a monospace font.
It completes a small family of technical elements: <code> is the source code, <kbd> is what the user types, and <samp> is what the system outputs in response. Using the right one makes documentation and tutorials clearer to both readers and assistive technology.
Syntax
<p>The program printed <samp>File not found</samp>.</p>
Example
<p>If you see <samp>404 Not Found</samp>, the page does not exist.</p>
Best practices
Frequently asked questions
What is the samp element for?
What is the difference between samp and code?
<samp> is program output; <code> is the source code itself.When would I use samp instead of kbd?
<samp> for what the computer outputs and <kbd> for what the user types in.