👀 Live Preview
Bold text rendered by the browser:
This sentence contains bold text for emphasis.

By the end of this tutorial, you’ll confidently use the bold element for stylistic emphasis in real-world HTML projects.
Wrap text in <b> for bold appearance without semantic urgency.
Know when stylistic bold differs from semantically important text.
Style with class, id, and inline style.
Highlight keywords, product names, and lead-in words in prose.
Use font-weight when bold is purely decorative.
Choose the right element so assistive tech conveys the right meaning.
<b> Tag?The bold element (<b>) represents a span of text to which stylistic attention is drawn, without implying greater importance. Browsers render it with bold font weight by default.
Use <b> for keywords, product names, or summary terms where you want visual weight but not semantic urgency. Reach for <strong> when the content is genuinely important.
The element is inline, so it flows inside paragraphs, headings, and lists. Default user-agent styles apply font-weight: bold automatically.
Wrap the text you want bold between opening and closing <b> tags:
<b>Your Bold Text Here</b><b> is an inline element—it nests inside paragraphs, lists, and headings.<b />) is not valid in HTML.| Use Case | Code Snippet | Result |
|---|---|---|
| Basic bold | <b>Bold</b> | Bold |
| In a sentence | Welcome to <b>CodeToFun</b> | Welcome to CodeToFun |
| Colored bold | <b style="color:#dc2626">Red</b> | Red |
| Important content | <strong>Warning</strong> | Warning |
| CSS only | font-weight: bold | Purely decorative styling |
| Tag-specific attrs | None | Global attributes only |
<b> vs <strong>Both render bold by default, but they carry different meaning for accessibility and semantics:
| Element | Meaning | Best for |
|---|---|---|
<b> | Stylistic attention | Keywords, product names, visually distinct terms |
<strong> | Strong importance | Warnings, critical instructions, urgent content |
| Appearance | Both bold by default | Default browser styles look the same |
| Accessibility | Different roles | strong adds emphasis; b does not imply urgency |
<p>Our new <b>Pro Plan</b> includes premium features.</p>
<p><strong>Warning:</strong> Do not share your password.</p>The <b> tag has no tag-specific attributes. Combine it with global attributes or CSS for additional styling:
class / id GlobalHook for CSS selectors and JavaScript targeting in design systems.
<b class="keyword">HTML</b>style InlineApply color, size, or weight directly on the element for one-off styling.
style="color: #dc2626;"lang OptionalHints the language of the bold text when it differs from the page language.
lang="fr"CSS alternative StylingUse font-weight: bold when bold is purely decorative and not part of content meaning.
.highlight { font-weight: bold; }<b style="color: #dc2626;">Bold and Red Text</b>Four bold-text patterns with copy-ready code, live previews, and hands-on practice.
Bold text rendered by the browser:
This sentence contains bold text for emphasis.
The simplest form: wrap words in <b> to make them bold.
<p>Welcome to <b>CodeToFun</b> tutorials.</p>Combine <b> with the style attribute for bold text in a custom color.
<b style="color: #dc2626;">Bold and Red Text</b>Here are the most frequent ways developers use the <b> tag.
Draw attention to important words inside a paragraph—useful in tutorials, summaries, and documentation.
<p>
In this document, the <b>HTML</b> language is used to build web pages.
The <b><b></b> tag helps highlight <b>important words</b> or <b>concepts</b>.
</p>Emphasize one word inside a heading. Note: headings are already bold by default—use <b> here only when you need extra visual weight on a specific word.
<h2><b>Important</b> Announcement</h2>Choose the right element for the meaning you intend:
Mark keywords or lead-in words that should stand out visually.
Default user-agent styles set font-weight: bold on <b> content.
Target b or a class to change color, size, or weight without changing HTML structure.
Readers spot key terms quickly while assistive tech does not treat them as urgently important.
The <b> tag is supported in every browser, including all modern browsers and Internet Explorer.
From legacy IE to the latest mobile browsers — the bold element is one of the oldest and most universally supported HTML tags.
Bottom line: Ship bold text markup with confidence. The <b> element works in every production environment today.
The <b> tag is a simple, universally supported way to make text bold for stylistic emphasis. Use it for keywords and visually distinct terms, reach for <strong> when importance matters, and avoid overusing bold so your content stays easy to scan.
<b> for stylistic emphasis on keywords or product names<strong> when content is genuinely important or urgentclass and CSS for consistent design systems<b> for warnings that need semantic urgency<b> and <strong> are interchangeable<b>Bookmark these before you ship — they’ll keep your bold text semantic and scannable.
<b> makes text bold without semantic urgency—ideal for keywords and product names.
<strong> is for genuinely important content; <b> is stylistic only.
No tag-specific attributes—use global class and style instead.
Keywords, product names, lead-in words, and summary terms in running text.
Patternsfont-weight: bold works for purely decorative bold without an HTML hook.
Supported in every browser including Internet Explorer—no polyfills needed.
Compatibility<b> element draws stylistic attention to text by making it bold, without implying extra importance. Use it for keywords, product names, or summary terms.<b> is stylistic. <strong> conveys strong importance and carries semantic weight for assistive technologies.<b> when bold styling is part of the content’s meaning. Use CSS font-weight for purely visual design that does not need an HTML semantic hook.class, id, and style, or apply CSS to style bold text.<b> element has universal support in all browsers, including Internet Explorer.Open the Try It editor and experiment with the b tag, inline styles, and keyword highlighting.
6 people found this page helpful