Tutorial Article

HTML <samp> Tag

The <samp> tag is used to represent sample output from a computer program, system, or device.Browsers typically display <samp> text in a monospace font, similar to how code or terminal output appears. Syntax Attributes Attribute Description None The <samp> tag has no unique attributes. It supports global and event attributes only. Example Output Browser Output [&hellip;]

Nov 21, 2025HTMLHTML TagsTutorials

The <samp> tag is used to represent sample output from a computer program, system, or device.
Browsers typically display <samp> text in a monospace font, similar to how code or terminal output appears.

Syntax

<samp>sample output</samp>

Attributes

AttributeDescription
NoneThe <samp> tag has no unique attributes. It supports global and event attributes only.

Example

<!DOCTYPE html>
<html>
<head>
  <title>HTML samp Tag Example</title>
</head>
<body>
  <h2>HTML &lt;samp&gt; Tag Example</h2>

  <p>Computer output may look like this:</p>

  <p><samp>Error: File not found.</samp></p>

  <p>Or a command result:</p>

  <p><samp>Ping successful — 0% packet loss.</samp></p>

  <p>Another example:</p>

  <p><samp>Login failed. Try again.</samp></p>

</body>
</html>

Output

Browser Output

You will see system-style output text displayed in a monospace font, similar to terminal or console messages.

Browser Support

Chrome
Chrome
Firefox
Firefox
Edge
Edge
Safari
Safari
Opera
Opera
IE
IE9+
✅Yes✅Yes✅Yes✅Yes✅Yes✅Yes

There is visible output, so you can check it in the browser.
Use our TryIt Editor to see how monospace system-output formatting looks.

Notes

  • <samp> is for program/system output, while <kbd> is for user input, and <code> is for code examples.
  • Great for tutorials, documentation, and examples that simulate command-line output.
  • You can style it with CSS to create a terminal-like appearance.

Conclusion

The <samp> tag helps display system-generated messages in a clear and semantic way.
It improves the readability of technical documentation and makes program outputs easy to identify.