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

<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.

Sign In Form

User your email and password to singn in

Provide your email and we will send you a password reset link.

Don’t have an account, signup here : 

HTML5 & CSS3

Tools and Tutorials

Want a Website

Want a website for your business ?

Please fill out the details below, so we can reach out to you.

Registration Form

Signup to track your record and much more.

We have sent you an email with a registration link. Please click the link to verify your email address, or enter the 6-digit OTP provided in the email.

Didn't receive the OTP. Regenerate OTP Resend