HTML Tags

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

html

<samp>sample output</samp>

Attributes

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

Example

html

<!DOCTYPE html>
<html>
<head>
  <title>HTML samp Tag Example</title>
</head>
<body>
  <h2>HTML <samp> 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

html

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

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesYes

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.