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.
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.
Use b when you want visual offset or attention without saying the text is important in the semantic sense.
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.
Use i when the text is offset for reasons such as an alternate voice, a technical term, a taxonomic name, or a foreign phrase.
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
strongoremwhen meaning is the reason - choose
boriwhen 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.
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:
bor, 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
- '
strongmeans importance, whilebis only visual offset or attention without that semantic meaning' - '
emmeans emphasis, whileiis 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
- What's the difference between event.stopPropagation and event.preventDefault?
- What's the equivalent of Java's Thread.sleep in JavaScript?
- What's the right way for handling Async functions for loading a .gif image?
- When are you supposed to use escape instead of encodeURI / encodeURIComponent?
- When coding in TypeScript should the generated .js files be committed to git?
- When does setTimeout start counting down?
- When is a CDATA section necessary within a script tag?
- When should I use curly braces for ES6 import?
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack 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.