HTML <b> Tag

Beginner
5 min read
Updated: Oct 2026
4 examples
Live preview

Definition and Usage

The <b> element brings attention to its contents without giving them special importance. Most browsers still render it in boldface, but that look is not its purpose.

Use it for keywords in a summary, product names in a review, or similar conventionally bold spans. For real importance use <strong>; for pure styling use CSS font-weight.

Baseline · Widely available.

Not deprecated. Stable across browsers since about July 2015 (and long before as HTML bold markup).

Historical note.

Formerly called the Boldface element. Presentational “make it bold” meaning is outdated — today <b> means bring attention, not importance.

Do not use for importance or headings.

Choose <strong> for urgency/importance and <h1>–<h6> for titles. Do not confuse <b> with <em> (stress emphasis) or <mark> (relevance/highlight).

HTML Syntax

syntax.html
<b> text</b>

Both start and end tags are required. Content is phrasing content (inline text and similar).

Attributes

<b> has no element-specific attributes. It uses global attributes; these are the ones you will reach for most often:

AttributeDescriptionTry it
(none specific)No tag-only attributes — meaning comes from the element itselfTry it
classRecommended hook (e.g. keyword, product) so styles stay maintainableTry it
idUnique identifier for scripting or fragment linksGlobal attribute

Global Attributes

The <b> tag also supports the Global Attributes in HTML.

Live Preview

Pick a phrase and see how <b> draws attention inside a sentence.

A real <b>. Apply a phrase, then compare the bold span with the surrounding text.

Attention span

The two most popular science courses are chemistry and physics.

<b>chemistry</b>

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Keywords in a Sentence

Highlight terms you want readers to notice, without marking them as important warnings.

HTML
<p>
  The two most popular science courses are
  <b>chemistry</b> and
  <b>physics</b>.
</p>
Try It Yourself

How It Works

  1. Write the sentence as normal paragraph text.
  2. Wrap each keyword in <b>…</b>.
  3. Leave the rest plain so attention stays on those spans.
  4. Browsers typically bold the wrapped text by default.

Example 2 — Product Name in a Review

Call out a product name the way print reviews often set it in bold.

HTML
<p>
  After a week of testing, I recommend the
  <b>CodeToFun Laptop 14</b>
  for beginners learning HTML.
</p>
Try It Yourself

How It Works

  1. Keep the review prose in a normal <p>.
  2. Wrap only the product name with <b>.
  3. Do not use <strong> unless the name itself is a critical warning or urgent claim.
  4. Result: visual attention without claiming extra importance.

Example 3 — Add a class Hook

MDN recommends a class so you can restyle or script different <b> uses later.

HTML
<p>
  This article covers
  <b class="keyword">text-level</b>
  elements such as
  <b class="keyword">HTML</b>
  phrasing tags.
</p>
Try It Yourself

How It Works

  1. Keep using <b> for the attention span.
  2. Add class (e.g. keyword) for meaning you care about in CSS/JS.
  3. Style by class later if you want a look other than default bold.
  4. Change once in CSS instead of editing every markup use case.

Example 4 — b vs strong

Same bold look by default — different meaning. Pick the element that matches intent.

HTML
<p>
  Topic keyword:
  <b>accessibility</b>.
</p>
<p>
  <strong>Warning:</strong>
  save your work before refreshing.
</p>
Try It Yourself

How It Works

  1. Use <b> when the word is a conventional bold span (keyword, label) without urgency.
  2. Use <strong> when the text is important or urgent.
  3. Do not choose by looks alone — both may appear bold.
  4. Screen readers treat importance from <strong> differently from a generic <b> span.

Edge Cases & Pitfalls

Most <b> mistakes come from treating it as a bold style switch.

semantics

Not a substitute for <strong>

Importance and urgency belong on <strong>, not <b>.

style

Pure decoration → CSS

If bold is only a design choice, use font-weight instead of wrapping everything in <b>.

structure

Do not fake headings with <b>

Headings need <h1>–<h6>. Bold text alone is not a heading in the outline.

compare

Also not <em> or <mark>

<em> is stress emphasis; <mark> is relevance/highlight. Use <b> only when those do not fit.

maintain

Prefer a class on repeated uses

Keywords vs product names can share <b> but different classes keep CSS and scripts flexible.

Browser Support

The <b> element is core HTML phrasing content in every browser. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

<b>

Widely available since about July 2015 (and earlier as HTML bold). Chrome, Firefox, Safari, Edge, and Opera all support it. Default bold styling can still be overridden by CSS.

98% Global support (approx.)
Google Chrome All
Full support
Mozilla Firefox All
Full support
Apple Safari All
Full support
Microsoft Edge All
Full support
Opera All
Full support
Samsung Internet All
Full support
Internet Explorer All
Supported
<b> Widely supported

Bottom line: Safe to use everywhere. Choose strong, em, mark, or CSS when the meaning is importance, stress, relevance, or pure style.

Key Takeaways

  • Role: <b> brings attention — it does not mark importance.
  • Use cases: keywords, product names, and similar conventionally bold spans.
  • Alternatives: <strong> for importance, CSS for decoration, headings for titles.
  • Practice: add a class when you reuse <b> for different roles.

One line: use <b> to draw eyes to text that is not specially important.

Default CSS Settings

User-agent stylesheets typically bold the element. Exact rules can vary slightly by browser:

default.css
b {
  font-weight: bold;
}

You may override this with CSS. Remember that changing the look does not change the element’s meaning.

Frequently Asked Questions

The b element draws the reader's attention to text that is not otherwise given special importance — for example keywords in a summary or product names in a review. Browsers usually render it bold.
Both often look bold. strong marks text as important or urgent for meaning and assistive tech. b only brings visual attention without that extra importance.
Use CSS font-weight when bold is only a design choice. Use b when you need a text-level hook for conventionally bold spans (keywords, product names) that are not semantically strong.
No. b supports only the global HTML attributes. Adding a class (for example class="keyword") is recommended so you can style or script use cases cleanly.
No. Use h1–h6 for headings. Styling alone can change how headings look; wrapping a heading in b does not make it a heading.
No. It is still valid HTML. Its meaning changed from a pure presentational bold tag to "bring attention to" text without implying importance.

Next: base

Set a default URL and target for relative links on the page.

base tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful