The
<b>tag in HTML is used to bolden text without adding extra importance or emphasis.
It visually highlights content by making it bold, often used for keywords, product names, or other text that needs attention — but not strong semantic meaning.
For emphasizing text semantically, you should use the<strong>tag instead.
Syntax
<b>Bold text here</b>Attributes
| Attribute | Description |
|---|---|
class | Assigns one or more class names for styling. |
id | Assigns a unique identifier to the bold text. |
style | Adds inline CSS styles to customize the appearance. |
title | Provides additional information as a tooltip. |
Example
<!DOCTYPE html>
<html>
<head>
<title>B Tag Example</title>
<style>
.highlight {
color: #29AB87;
font-weight: bold;
background-color: #f0f0f0;
padding: 2px 4px;
border-radius: 4px;
}
</style>
</head>
<body>
<h1>HTML <b> Tag Example</h1>
<p>
The <b> tag makes text <b class="highlight" id="keyword" title="Bold Text">bold</b> without changing its meaning.
</p>
<p>
Example: This is a <b>bold statement</b> in a paragraph.
</p>
</body>
</html>Output
Browser Output
Use our TryIt Editor to see the output.
Browser Support
Chrome | Firefox | Edge | Safari | Opera | IE9+ |
|---|---|---|---|---|---|
| ✅Yes | ✅Yes | ✅Yes | ✅Yes | ✅Yes | ✅Yes |
The <b> tag displays text in bold weight to make it stand out visually, without adding semantic importance.
Notes
- The
<b>tag is used purely for visual styling — it doesn’t convey importance or emphasis. - For important or emphasized text, prefer
<strong>or<em>. - The default browser style makes
<b>text bold, but this can be customized with CSS. - It is an inline element, meaning it doesn’t start on a new line.
Conclusion
The <b> tag is useful for visually highlighting text without changing its meaning.
It’s best for stylistic purposes like marking keywords or names, while <strong> should be used for important or emphasized content.