What's the HTML character entity for the # sign?

HtmlCharacterHtml EntitiesHashtagCharacter Entities

Html Problem Overview


What's the HTML character entity for the # sign? I've looked around for "pound" (keeps returning the currency), and "hash" and "number", but what I try doesn't seem to turn into the right character.

Html Solutions


Solution 1 - Html

You can search it on the individual character at fileformat.info. Enter # as search string and the 1st hit will lead you to U+0023. Scroll a bit down to the 2nd table, Encodings, you'll see under each the following entries:

HTML Entity (decimal)  #
HTML Entity (hex)      #

Solution 2 - Html

For # we have #.

Bear in mind, though, it is a new entity (IE9 can't recognize it, for instance). For wide support, you'll have to resort, as said by others, the numerical references # and, in hex, &#x23.

If you need to find out others, there are some very useful tools around.

Solution 3 - Html

The "#" -- like most Unicode characters -- has no particular name assigned to it in the W3 list of "Character entity references" http://www.w3.org/TR/html4/sgml/entities.html . So in HTML it is either represented by itself as "#" or a numeric character entity "#" or "#" (without quotes), as described in "HTML Document Representation" http://www.w3.org/TR/html4/charset.html .

Alas, all three of these are useless for escaping it in a URL. To transmit a "#" character to the web server in a URL, you want to use "URL encoding" aka "percent encoding" as described in RFC 3986, and replace each "#" with a "%23" (without quotes).

Solution 4 - Html

There is no HTML character entity for the # character, as the character has no special meaning in HTML.

You have to use a character code entity like # if you wish to HTML encode it for some reason.

Solution 5 - Html

# or #

http://www.asciitable.com/ has information. Wikipedia also has pages for most unicode characters.

http://en.wikipedia.org/wiki/Number_sign

Solution 6 - Html

The numerical reference is #.

Solution 7 - Html

You can display "#" in some ways as shown below:

# or # or #

In addtion, you can display "♯" which is different from "#" in some ways as shown below:

♯ or ♯ or ♯

Solution 8 - Html

# is the best option because it is the only one that doesn't include the # (hash) in it. Supported by old browsers or not, it is the best practice going forward.

(What is the point of encoding something using the same symbol you are encoding?)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionchimericalView Question on Stackoverflow
Solution 1 - HtmlBalusCView Answer on Stackoverflow
Solution 2 - HtmlacdcjuniorView Answer on Stackoverflow
Solution 3 - HtmlDavid CaryView Answer on Stackoverflow
Solution 4 - HtmlGuffaView Answer on Stackoverflow
Solution 5 - HtmlwhatsisnameView Answer on Stackoverflow
Solution 6 - HtmlMatthew FlaschenView Answer on Stackoverflow
Solution 7 - HtmlKai - Kazuya ItoView Answer on Stackoverflow
Solution 8 - Htmluser3186206View Answer on Stackoverflow