When prefixes a number, it is read as 'number'. "A #2 pencil", for example, indicates "a number-two pencil". This usage is historically rarer in print than the abbreviation , although '#' has recently overtaken 'No.' in total popularity worldwide, (but not
British English). In addition to 'No.' and '#', the symbol or just the word 'number' are also used. When used in this manner, # is often
superscript, like: "a #2 pencil" — but typically not extending above the
cap line. When is
after a number, it is read as 'pound' or 'pounds', meaning the unit of weight. The text "5# bag of flour" would mean "five-pound bag of flour". This is rare outside North America.
Mathematics • In
set theory, #
S is one possible notation for the
cardinality or size of the
set S, instead of |S|. That is, for a set S = \{s_1,s_2,s_3, \dots , s_n\}, in which all s_i are mutually distinct, \#S = n = |S|. This notation is only sometimes used for
finite sets, usually in
number theory, to avoid confusion with the
divisibility symbol, e.g. a \mid b. • In
topology,
A#
B is the
connected sum of
manifolds
A and
B, or of knots
A and
B in
knot theory. • In
number theory,
n# is the
primorial of
n. • In
constructive mathematics, # denotes an
apartness relation. • In
computational complexity theory,
#P denotes a
complexity class of
counting problems. The standard notation for this class uses the number sign symbol, not the
sharp sign from music, but it is pronounced "sharp P". More generally, the number sign may be used to denote the class of counting problems associated with any class of search problems.
Computing • In
Unicode and
ASCII, the symbol has a
code point as and
entity code in
HTML5. • In many scripting languages and data file formats, especially ones that originated on Unix, introduces a comment that goes to the end of the line. The combination at the start of an executable file is a
shebang,
hash-bang or
pound-bang, used to tell the operating system which program to use to run the script (see
magic number). This combination was chosen so it would be a comment in the scripting languages. • In the
C preprocessor (used by
C and many other languages), at the start of a line starts a preprocessor
directive. Inside macros (after ) it is used for various purposes; for example is used for token
concatenation. • In
Unix shells, is placed by convention at the end of a
command prompt to denote that the user is working as
root. • is used in a
URL of a
web page or other resource to introduce a '
fragment identifier' an id which defines a position within that resource. In HTML, this is known as an
anchor link. For example, in the URL the portion after the () is the fragment identifier, in this case denoting that the display should be moved to show the tag marked by in the HTML. •
Internet Relay Chat: on (IRC) servers, precedes the name of every
channel that is available across an entire IRC network. • In
lightweight markup languages, such as
wikitext, is often used to introduce numbered list items. • In the
Perl programming language, is used as a modifier to array syntax to return the index number of the last element in the
array, e.g., an array's last element is at . The number of elements in the array is , since Perl arrays default to using zero-based indices. If the array has not been defined, the return is also undefined. If the array is defined but has not had any elements assigned to it, e.g., , then returns . See the section on
Array functions in the Perl language structure article. • is used in the
Modula-2 and
Oberon programming languages designed by
Niklaus Wirth and in the
Component Pascal language derived from Oberon to denote the
not equal symbol, as a stand-in for the mathematical unequal sign , being more intuitive than or . For example: • In
Rust, is used for attributes such as in . • In
OCaml, is the operator used to call a method. • In
Common Lisp, is a dispatching
read macro character used to extend the
S-expression syntax with short cuts and support for various data types (
complex numbers, vectors and more). • In
Scheme, is the prefix for certain syntax with special meaning. • In
Standard ML, , when prefixed to a field name, becomes a projection function (function to access the field of a record or tuple); also, prefixes a
string literal to turn it into a character literal. • In
Mathematica syntax, , when used as a variable, becomes a pure function (a placeholder that is mapped to any variable meeting the conditions). • In
LaTeX, , when prefixing a number, references an arguments for a user defined command. For instance \newcommand{\code}[1]{\texttt{#1}}. • In
Javadoc, is used with the tag to introduce or separate a field, constructor, or method member from its containing class. • In
Redcode and some other dialects of
assembly language, is used to denote immediate mode addressing, e.g., , which means "load accumulator A with the value 10" in
MOS 6502 assembly language. • in
HTML,
CSS,
SVG, and other computing applications is used to identify a color specified in
hexadecimal format, e.g., . This usage comes from
X11 color specifications, which inherited it from early assembler dialects that used to prefix hexadecimal constants, e.g.: ZX Spectrum
Z80 assembly. • In
Be-Music Script, every command line starts with . Lines starting with characters other than are treated as comments. • The use of the hash symbol in a
hashtag is a phenomenon conceived by
Chris Messina, and popularized by social media network
Twitter, as a way to direct conversations and topics amongst users. This has led to an increasingly common tendency to refer to the symbol itself as
hashtag. • In programming languages like PL/1 and Assembler used on IBM mainframe systems, as well as JCL (Job Control Language), the (along with and ) are used as additional letters in identifiers, labels and data set names. • In
J, is the
Tally or
Count function, and similarly in
Lua, can be used as a shortcut to get the length of a table, or get the length of a string. Due to the ease of writing over longer function names, this practice has become standard in the Lua community. • In Dyalog
APL, is a reference to the root
namespace while is a reference to the current space's parent namespace. • In
Ada, the character is used in based integer literals, which take the form , where is an integer from 2 to 16 specifying the radix, and are the digits valid in that base (0-9, optionally A-F for bases above 10).
Other uses •
Algebraic notation for chess: A hash after a move denotes
checkmate. •
American Sign Language transcription: The hash prefixing an all-caps word identifies a lexicalized fingerspelled sign, having some sort of blends or letter drops. All-caps words without the prefix are used for standard English words that are fingerspelled in their entirety. •
Copy writing and
copy editing: Technical writers in
press releases often use three number signs, directly above the boilerplate or underneath the body copy, indicating to media that there is no further copy to come. •
Footnote symbols (or endnote symbols): Due to its ready availability in many computer fonts and directly on computer keyboards, and other symbols (such as the
caret ()) have in recent years begun to be occasionally used in catalogues and reports in place of more traditional symbols (esp.
dagger, double-dagger,
pilcrow). • Linguistic
phonology: denotes a word boundary. For instance, means that becomes when it is the last segment in a word (i.e. when it appears before a word boundary). • Linguistic
syntax: A hash before an example sentence denotes that the sentence is semantically ill-formed, though grammatically well-formed. For instance, "#The toothbrush is pregnant" is a grammatically correct sentence, but the meaning is odd. •
Medical prescription drug delimiter: In some countries, such as
Norway or
Poland, is used as a
delimiter between different drugs on medical prescriptions. • Medical shorthand: The hash is often used to indicate a
bone fracture. For example, is often used for "fractured
neck of femur". In radiotherapy, a full dose of radiation is divided into smaller doses or 'fractions'. These are given the shorthand to denote either the number of treatments in a prescription (e.g. ), or the fraction number (). • As a
proofreading mark, to indicate that a space should be inserted. • Publishing: When submitting a science fiction manuscript for publication, a number sign on a line by itself (indented or centered) indicates a
section break in the text. •
Scrabble: Putting a number sign after a word indicates that the word is found in the British word lists, but not the
North American lists. •
Teletext and
DVB subtitles (in the UK and Ireland): The hash symbol, resembling music notation's sharp sign, is used to mark text that is either sung by a character or heard in background music, e.g. ==Unicode==