← Back to blog/Guides

Markdown Text Formatting: Bold, Italics, Underline, and More

A practical formatting reference that separates portable bold and italics from HTML-dependent underline, subscript, superscript, color, and font sizing.

F
Faizan Khan
• 7 min read

Use **text** for bold and *text* for italics in Markdown. Underline, subscript, superscript, text color, and arbitrary font size do not have universal core Markdown syntax. Those usually need permitted HTML, site styles, or a documented renderer extension, so a snippet that works in one editor may fail elsewhere.

Markdown
1**Required:** Keep the original file.
2
3*Optional:* Add a reviewer note.

The semantic HTML is:

HTML
1<p><strong>Required:</strong> Keep the original file.</p>
2<p><em>Optional:</em> Add a reviewer note.</p>

A formatting compatibility reference

GoalSourcePortability
Strong emphasis**Required**Core Markdown
Emphasis*Optional*Core Markdown
Combined emphasis***Read carefully***Core Markdown, with delimiter rules
Literal code`filename.md`Core Markdown
Strikethrough~~Outdated~~GFM or another extension
Underline<u>Text</u>Requires permitted HTML
SubscriptH<sub>2</sub>ORequires permitted HTML
Superscriptx<sup>2</sup>Requires permitted HTML
Color or exact font sizeA styled element or site componentRenderer and style-policy dependent

Pick the smallest feature that communicates the meaning. A required field should be called "Required," not merely painted red. A file path should be code, not bold italics. A heading should identify a section, not just create larger text.

Bold and italics: delimiters must touch the text

Markdown
1**This is strong emphasis.**
2*This is emphasis.*
3***This combines both.***

Avoid spaces just inside the delimiters:

Markdown
1** This does not reliably create bold text. **

Underscores can also mark emphasis, but they have special restrictions within words. Asterisks are usually easier when emphasizing part of a word. Literal identifiers such as review_status are better expressed as code than forced through emphasis rules.

The CommonMark emphasis rules explain delimiter boundaries. In practical documentation, whole-word emphasis and consistent asterisk spelling keep the source easier to review.

Do not bold every other sentence. If everything looks urgent, the reader cannot find the actual decision. Use emphasis for short labels, important contrasts, and terms introduced in context.

Escaping punctuation is different from code formatting

To display the literal asterisks in prose, escape them:

Markdown
1Write \*\*Required\*\* in the source.

The backslashes prevent those punctuation characters from becoming emphasis markers. Inline code is another option when you are discussing syntax: **Required**.

Inside code spans or fenced blocks, a backslash is generally literal. Do not copy prose escapes into executable examples unless the program itself needs them. The code-block guide explains the distinction and longer delimiters for samples containing backticks.

Underlining needs an explicit platform decision

HTML
1<u>Text with an underline</u>

That is HTML, not an extra Markdown delimiter. Some services preserve it; others filter it or apply their own rendering policy. Double underscores mean strong emphasis, not underline. Double equals signs and other invented wrappers are not a portable replacement.

Underlined non-link text can look like navigation. If the purpose is emphasis, bold is usually less ambiguous. If the purpose is a link, use actual Markdown link syntax so the destination and interaction are real.

Where semantic distinctions matter, remember that the visual effect alone is not the whole meaning of an HTML element. Choose the publication's established pattern rather than adding arbitrary presentational markup throughout the page.

Subscript and superscript

For a renderer allowing these HTML elements:

HTML
1Water: H<sub>2</sub>O
2Area: x<sup>2</sup>

The 2 is positioned below or above the baseline respectively. H~2~O and x^2^ belong to extensions in some systems, not universally supported Markdown.

Unicode characters such as a superscript digit can work as actual text, but they are not a general formatting system for arbitrary words or expressions. They can also behave differently during searching, copying, or text normalization. For a technical formula, confirm the reader can interpret the expression and use the destination's documented math support when needed.

Do not create citations merely by typing a raised number. A real footnote should connect the reference to its note and, where supported, provide return navigation.

Color and font size belong to the presentation layer

On a site where you control permitted HTML and CSS:

HTML
1<span class="status-label">Action required</span>
CSS
1.status-label {
2 color: #9f241b;
3 font-weight: 700;
4}

This is an example styling hook, not a guarantee that a hosted Markdown service accepts custom classes. The label still says "Action required" when the color is unavailable.

Avoid using a heading marker solely to enlarge a sentence. A heading contributes to the document outline and may appear in the table of contents. For display-only sizing, use the site's typography settings or an approved class.

HTML inline styles use a string, while React/MDX styles use an object:

HTML
1<span style="font-size: 1.1em;">Larger label</span>
MDX
1<span style={{ fontSize: '1.1em' }}>Larger label</span>

The React style reference documents object values and camel-cased property names. A sanitizer may remove either approach in a different publication pipeline.

Use formatting to clarify a decision

Consider this example:

Markdown
1**Before replacing the file:** Keep a copy of the current version.
2
3Set `mode` to `preview`. The preview is *not* the published version.

The bold label names the timing, code identifies the literal field and value, and italics emphasize a contrast. Nothing depends on a custom color or font size.

For genuinely risky actions, write the consequence and safeguard in a warning callout before the action. Do not rely on decorative styling to compensate for an unclear instruction. Use strikethrough only when showing an old value is useful; otherwise remove stale information.

FAQ

How do I bold text in Markdown?

Wrap the text in two asterisks on each side, without spaces just inside them: **bold text**. Double underscores can also create strong emphasis.

Does Markdown have underline syntax?

Core Markdown has no underline delimiter. Permitted HTML can provide an underline, but support and appearance depend on the renderer.

Can I change text color or font size in any Markdown file?

No. Those are presentation features controlled by the destination's HTML policy, stylesheet, components, or extensions, not guaranteed core Markdown capabilities.

Continue This Guide