Open In App

HTML <samp> Tag

Last Updated : 11 Jul, 2025
Summarize
Comments
Improve
Suggest changes
Share
Like Article
Like
Report

It is a phrase tag and is used to define the sample output text from a computer program.

Syntax: 

<samp> Contents... </samp>

Example: In this example, we are using the <samp> tag to display sample output or code. Here, the text "A computer science portal for Geeks" is rendered in a monospace font, indicating sample output.

HTML
<!DOCTYPE html>
<html>

<body>

    <h1>GeeksforGeeks</h1>
    <h2>&lt;samp&gt; Tag</h2>
    <!-- html <samp> tag is used here -->
    <samp>A computer science portal for Geeks</samp>

</body>

</html>

Output: 


Supported Browsers: 


Similar Reads