189

How can I display an infinity symbol (like the one in the picture) using HTML?

infinity symbol

Community
  • 1
  • 1
user94154
  • 16,176
  • 20
  • 77
  • 116

9 Answers9

347

Use the HTML entity ∞ or ∞.

ЯegDwight
  • 24,821
  • 10
  • 45
  • 52
  • 1
    @FranciscoCorralesMorales Well... [googling for `utf-8 infinity symbol`](https://www.google.pl/#q=utf-8+infinity+symbol&safe=active) gives me many interesting results within 3 seconds, including [utf8icons.com](http://www.utf8icons.com/character/8734/infinity), [fileformat.info](http://www.fileformat.info/info/unicode/char/221e/index.htm) and others. – trejder Jun 12 '14 at 11:00
  • @FranciscoCorralesMorales also [MDN](https://developer.mozilla.org) site is very good and increasing in data available. – PhoneixS Jun 25 '14 at 15:07
114

You can use the following:

  • literal: (if the encoding you use can encode it — UTF-8 can, for example)
  • character reference: ∞ (decimal), ∞ (hexadecimal)
  • entity reference: ∞

But whether it is displayed correctly does also depend on the font the text is displayed with.

Paul D. Waite
  • 96,640
  • 56
  • 199
  • 270
Gumbo
  • 643,351
  • 109
  • 780
  • 844
  • 17
    +1 for mentioning the font-dependence. This is often overlooked in case of "unicode characters". – BalusC Feb 12 '10 at 21:02
27

This does not require a HTML entity if you are using a modern encoding (such as UTF-8). And if you're not already, you probably should be.

Matthew Flaschen
  • 278,309
  • 50
  • 514
  • 539
  • 4
    Curious: since I don't have a ∞ on my keyboard, would I always have to copy/paste the previous ∞? How do you get it there the first time? I find it easier and faster to type `∞`, but if there's a faster way to get this on to the screen with just a plain ol' keyboard, please share – FrustratedWithFormsDesigner Feb 12 '10 at 21:00
  • 4
    The “Typing Special Characters” section here might help: http://www.xvsxp.com/misc/keyboard.php – Paul D. Waite Feb 12 '10 at 21:07
  • I'm aware of the character maps, but I'm a fast typist and having to toggle to a UI and then back to the editor slows me down. I can still type `∞` faster. – FrustratedWithFormsDesigner Feb 12 '10 at 21:14
  • 1
    I don't think there's a default key for infinity. However, like anything else you can set up a key shortcut. Jonas Kölker recommended Compose+1/0 (http://stackoverflow.com/questions/311244/keyboard-layout-for-international-programmers/662389#662389) – Matthew Flaschen Feb 12 '10 at 21:33
  • 3
    What's your environment? On the Mac, it's option-5. In GTK+, it's C-S-u 2 2 1 E. On Windows, it's ALT 2 3 6 (keypad). A good text editor will also have a way to define an abbrev for it. – Ken Feb 14 '10 at 00:19
10

From Wikipedia:

∞
brad
  • 73,826
  • 21
  • 73
  • 85
10

According to List of XML and HTML character entity references:

∞

The Google search using your original question gets several useful results: How can I display an infinity symbol using HTML.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
artlung
  • 33,305
  • 16
  • 69
  • 121
6

According to this page, it's ∞.

rhughes
  • 9,257
  • 11
  • 59
  • 87
FrustratedWithFormsDesigner
  • 26,726
  • 31
  • 139
  • 202
6

∞

Gregoire
  • 24,219
  • 6
  • 46
  • 73
4

Like ЯegDwight said, you can use the HTML entity ∞ or ∞. A easy source of getting these codes, is to look at this entity list.

You can also use them in CSS, which was what I was looking for, just like font-awesome does. A simple CSS based solution would be to have something like:

.infinity-ico:before {
    content: '\221E';
}
Kaiden Prince
  • 472
  • 3
  • 18
3

Infinity is a reserved character in HTML. Following are its values in various forms.

  • Hex : 8734
  • Decimal : 221E
  • Entity : ∞

To use in html code

<p>The html symbol is &#8734; </p>
<p>The html symbol is &#x221E; </p>
<p>The html symbol is &infin; </p>

Reference : HTML Symbols - HTML Infinity Symbol

arjun
  • 1,645
  • 1
  • 19
  • 19