HTML
Web Development
Coding
Programming
Web Design

What's the difference between <b> and <strong>, <i> and <em>?

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

The pairs b and strong, and i and em, often look similar in the browser because their default styles are usually bold and italic. The difference is semantic meaning. strong and em express importance and emphasis, while b and i are for offset text that does not necessarily carry that semantic weight.

b Versus strong

Use strong when the content has strong importance, seriousness, or urgency.

html
<p><strong>Warning:</strong> This action cannot be undone.</p>

Use b when you want visual offset or attention without saying the text is important in the semantic sense.

html
<p><b>Product code:</b> AB-204</p>

Browsers often render both in bold by default, but they do not mean the same thing. The point of semantic HTML is that meaning should not depend only on the visual CSS presentation.

i Versus em

Use em when the text needs stress emphasis, the kind that changes how a sentence should be read.

html
<p>I said <em>today</em>, not tomorrow.</p>

Use i when the text is offset for reasons such as an alternate voice, a technical term, a taxonomic name, or a foreign phrase.

html
<p>The term <i>in vitro</i> appears often in biology papers.</p>

Again, both are usually italic by default, but only em expresses emphasis.

Why the Semantic Difference Matters

Semantic HTML helps browsers, assistive technology, search tools, and future maintainers understand the document structure. The browser can style tags however CSS tells it to, but the underlying element choice still communicates intent.

That is the important principle:

  • choose strong or em when meaning is the reason
  • choose b or i when visual or typographic offset is the reason

This keeps markup descriptive instead of purely decorative.

Styling Is a Separate Concern

If you just want text to look bold or italic, CSS is often the cleaner tool.

html
<p><span class="label">Product code:</span> AB-204</p>
css
.label {
  font-weight: bold;
}

That avoids pretending there is semantic importance when the real requirement is only a style choice.

Accessibility Considerations

Assistive technologies may treat semantic emphasis and importance differently from purely visual markup. The exact rendering depends on the tool, but the general rule still holds: semantic elements give assistive software more useful information than presentational choices alone.

That does not mean every bold word should become strong. Overusing semantic emphasis weakens the meaning, just as overusing actual emphasis in writing makes it less effective.

A Practical Rule of Thumb

Ask yourself one question: if the default browser styling disappeared, would the chosen tag still describe the text correctly?

If yes, you likely picked the right semantic element.

Examples:

  • urgent warning: strong
  • spoken stress: em
  • foreign phrase: i
  • visual label with no special semantic meaning: b or, often better, CSS on a neutral element

Common Pitfalls

The biggest mistake is choosing tags only by how they look instead of by what they mean.

Another mistake is assuming b means the same thing as strong, or i means the same thing as em, just because the browser default styling is similar.

A third issue is using semantic tags everywhere for styling alone, when CSS would express the real intention more cleanly.

Summary

  • 'strong means importance, while b is only visual offset or attention without that semantic meaning'
  • 'em means emphasis, while i is for alternate voice, foreign terms, or other offset text'
  • Similar default styling does not mean the elements are interchangeable
  • Use CSS when the goal is purely visual presentation
  • Choose semantic elements based on meaning, not just browser appearance

Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.