JavaScript String big() Method

Beginner
⏱️ 8 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Deprecated

What You’ll Learn

String.prototype.big() is a deprecated HTML wrapper method (same API as MDN String.prototype.big()). It returns a string that wraps your text in a <big> tag. Learn what it builds, why that element is obsolete, and how to replace it with CSS font-size — with five examples and try-it labs.

01

Kind

Instance method

02

Returns

HTML string

03

Status

Deprecated

04

Params

None

05

Mutates?

No

06

Prefer

CSS font-size

Introduction

Early JavaScript included helpers that wrapped text in HTML presentation tags — big(), small(), bold(), italics(), and others. They made it easy to inject markup with innerHTML.

Today those wrappers are deprecated. big() still works in browsers for compatibility, but the <big> element itself was removed from HTML. Font size belongs in CSS.

💡
Learn it, don’t ship it

Study big() so you can recognize legacy code. For new pages, style text with font-size (or a utility class) instead of building <big> strings.

This page is part of JavaScript String Methods. Related topics include anchor() and blink().

Understanding the big() Method

Calling str.big() does not create a live DOM node and does not take arguments. It concatenates an HTML string: <big> + text + </big>.

  • It is an instance method on strings (auto-boxed if needed).
  • It returns a new string — the original is unchanged.
  • No parameters — just str.big().
  • Prefer CSS font-size for real UI.

📝 Syntax

General form of String.prototype.big:

JavaScript
str.big()

Parameters

None.

Return value

A string beginning with a <big> start tag, then the text of str, then a </big> end tag.

Common patterns

JavaScript
"Hello, world".big();
// 'Hello, world'

// Prefer this in new code:
const el = document.getElementById("yourElemId");
el.style.fontSize = "2em";

⚡ Quick Reference

GoalCode
Legacy HTML stringstr.big()
Result shape<big>...</big>
Modern font sizeel.style.fontSize = "2em"
Use in new apps?No — deprecated

🔍 At a Glance

Four facts to remember about String.big().

Returns
string

HTML markup text

Status
deprecated

Compatibility only

Tag
<big>

Removed from HTML

Replace with
font-size

CSS, not tags

📋 big() vs CSS font-size

str.big()el.style.fontSize
ResultHTML stringStyled live element
Valid HTML today?No (<big> removed)Yes
Recommended?NoYes
Best forReading legacy codeNew UI / apps

Examples Gallery

Examples follow MDN String.big() patterns. Use View Output or Try It Yourself for each case.

📚 Getting Started

See the exact HTML string big() builds.

Example 1 — Basic big()

MDN-style call that wraps text in <big>.

JavaScript
const contentString = "Hello, world";
contentString.big();
// 'Hello, world'
Try It Yourself

How It Works

The method returns markup text only. Nothing is added to the document until you assign it somewhere (for example innerHTML).

Example 2 — Empty String and Special Characters

Tags are still produced for empty text; content is not HTML-escaped.

JavaScript
"".big();           // ''
"A < B".big();      // 'A < B'
typeof "x".big();   // "string"
Try It Yourself

How It Works

Unlike some attribute wrappers, big() does not escape < inside the text. That is another reason to avoid injecting untrusted strings via innerHTML.

📈 Practical Patterns

Legacy injection patterns and the modern CSS replacement.

Example 3 — Injecting with innerHTML (Legacy)

How older demos used the returned string — still produces obsolete markup.

JavaScript
const contentString = "Hello, world";
const html = contentString.big();
// document.body.innerHTML = html;  // legacy pattern — avoid in new apps

console.log(html);
// Warning:  is not a valid element in modern HTML
Try It Yourself

How It Works

Even if a browser still renders larger text for <big>, the element is obsolete. Use CSS instead.

Example 4 — Other HTML Wrappers Nearby

Recognize the same pattern family — all deprecated.

JavaScript
"Hi".big();     // 'Hi'
"Hi".small();   // 'Hi'
"Hi".bold();    // 'Hi'
"Hi".italics(); // 'Hi'
Try It Yourself

How It Works

These helpers share one idea: return presentational HTML strings. Modern code styles elements with CSS (and semantic tags when needed).

Example 5 — Modern Replacement with CSS

MDN’s recommended approach — control size with font-size.

JavaScript
const el = document.createElement("p");
el.textContent = "Hello, world";
el.style.fontSize = "2em";

// document.body.appendChild(el);
console.log(el.style.fontSize);
console.log(el.outerHTML);
Try It Yourself

How It Works

You get a real element, valid markup, and a clear size value. Prefer a CSS class in production so styles stay maintainable.

🚀 Common Use Cases

  • Reading legacy tutorials — recognize HTML wrapper methods in old samples.
  • Migrating old scripts — replace big() with CSS font-size.
  • Teaching string immutability — show that methods return new strings.
  • Not for new apps — do not use big() to enlarge UI text.
  • Design systems — use type scale tokens / utility classes instead.
  • Safer markup — prefer textContent + CSS over innerHTML strings.

🧠 How big() Builds Markup

1

Start with text

You call str.big() on a string receiver.

Input
2

Wrap with tags

Concatenate <big> + text + </big>.

Wrap
3

Return an HTML string

No DOM node is created — only text markup.

Result
4

Prefer CSS instead

Set font-size on a real element for valid styling.

📝 Notes

  • big() is deprecated — standardized only for compatibility.
  • The <big> element was removed from the HTML specification.
  • It returns a string, not a DOM node.
  • It takes no parameters.
  • Other HTML wrappers (small(), bold(), fontcolor(), …) share the same fate.
  • Avoid assigning untrusted strings to innerHTML.

Browser & Runtime Support

String.prototype.big() is still widely implemented for compatibility, but it is deprecated. Do not use it in new projects.

Deprecated · Legacy

String.big()

Available in modern browsers for old code, but MDN recommends CSS font-size instead.

Legacy Compatibility only
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
big() Avoid in new code

Bottom line: Recognize big() in legacy samples. For new UI, control text size with CSS font-size — never rely on the obsolete element from HTML wrapper methods.

Conclusion

String.prototype.big() builds an obsolete <big>...</big> HTML string. It is useful for understanding history and migrating old code — not for writing new features.

Continue with blink(), at(), or the String methods hub.

💡 Best Practices

✅ Do

  • Use CSS font-size (or design tokens) for larger text
  • Prefer semantic headings when size means hierarchy
  • Prefer textContent over string-built HTML
  • Replace big() when you touch legacy files
  • Learn wrappers only to recognize deprecated APIs

❌ Don’t

  • Use big() in new production code
  • Assume <big> is valid modern HTML
  • Inject untrusted big() output via innerHTML
  • Expect big() to return a live element
  • Mix HTML wrappers with modern component frameworks

Key Takeaways

Knowledge Unlocked

Five things to remember about String.big()

Deprecated HTML wrapper — prefer CSS font-size.

5
Core concepts
⚠️ 02

Status

deprecated

Legacy
03

Markup

invalid

HTML
04

Replace

font-size

Modern
05

Mutates

no

Immutable

❓ Frequently Asked Questions

String.prototype.big() returns an HTML string that wraps the text in a <big> element — for example "Hello".big() returns '<big>Hello</big>'. It takes no parameters.
Yes. MDN marks all HTML wrapper methods as deprecated. The <big> element itself was removed from the HTML specification. Prefer CSS font-size instead.
The <big> element is obsolete. Modern HTML and accessibility guidelines expect font size to come from CSS, not presentational tags.
No. Strings are immutable. big() returns a new string containing HTML markup. The original text stays the same.
Set CSS font-size on an element, for example element.style.fontSize = "2em", or use a CSS class. Do not build <big> tags with string methods.
It remains widely available for compatibility, but you should not use it in new code. Prefer CSS.
Did you know?

HTML once had both <big> and <small> for relative font size. <small> survived with a semantic meaning (side comments), while <big> was removed — size alone is a CSS concern.

More String Methods

Return to the hub for slice, trim, replace, and more.

String methods hub →

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.

8 people found this page helpful