In
word processing A word processor (WP) is a device or computer program that provides for input, editing, formatting, and output of text, often with some additional features.
Word processor (electronic device), Early word processors were stand-alone devices dedicate ...
and
digital typesetting, a non-breaking space (), also called NBSP, required space, hard space, or fixed space (in most
typeface
A typeface (or font family) is a design of Letter (alphabet), letters, Numerical digit, numbers and other symbols, to be used in printing or for electronic display. Most typefaces include variations in size (e.g., 24 point), weight (e.g., light, ...
s, it is not of
fixed width), is a
space character
A whitespace character is a character data element that represents white space when text is
rendered for display by a computer.
For example, a ''space'' character (, ASCII 32) represents blank space such as a word divider in a Western scri ...
that prevents an
automatic line break at its position. In some formats, including
HTML
Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets ( ...
, it also prevents consecutive
whitespace character
A whitespace character is a character data element that represents white space when text is
rendered for display by a computer.
For example, a ''space'' character (, ASCII 32) represents blank space such as a word divider in a Western scrip ...
s from collapsing into a single space. Non-breaking space characters
with other widths also exist.
Uses
Despite having layout and uses similar to those of
whitespace
White space or whitespace may refer to:
Technology
* Whitespace characters, characters in computing that represent horizontal or vertical space
* White spaces (radio), allocated but locally unused radio frequencies
* TV White Space Database, a m ...
, it differs in contextual behavior.
Non-breaking behavior
Text-processing software typically assumes that an automatic line break may be inserted anywhere a space character occurs; a non-breaking space prevents this from happening (provided the software recognizes the character).
For example, if the text "100 km" will not quite fit at the end of a line, the software may break the line between "100" and "km". Using a non-breaking space between "100" and "km" will prevent this behaviour. This guarantees that the text "100 km" will not be broken—if it does not fit at the end of a line, it is moved in its entirety to the next line. For this reason, many style guides recommend using a non-breaking space between numbers and their associated units.
In
French typography, non-breaking spaces are used before "high punctuation" (
:
,
;
,
?
, and
!
), on the interior side of
guillemets (
«
and
»
), and before
footnote
In publishing, a note is a brief text in which the author comments on the subject and themes of the book and names supporting citations. In the editorial production of books and documents, typographically, a note is usually several lines of tex ...
s. In the case of
;
,
?
,
!
, and footnotes (unless enclosed by parentheses), it is specifically the
narrow non-breaking space that is used.
In
German typography, it is used between multi-part abbreviations (e.g., "''z.B.''", "''d.h.''", "''v.l.n.r.''").
Non-collapsing behavior
A second common application of non-breaking spaces is in
plain text
In computing, plain text is a loose term for data (e.g. file contents) that represent only characters of readable material but not its graphical representation nor other objects ( floating-point numbers, images, etc.). It may also include a lim ...
file formats such as
SGML
The Standard Generalized Markup Language (SGML; International Organization for Standardization, ISO 8879:1986) is a standard for defining generalized markup languages for documents. ISO 8879 Annex A.1 states that generalized markup is "based on t ...
,
HTML
Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets ( ...
,
TeX
Tex, TeX, TEX, may refer to:
People and fictional characters
* Tex (nickname), a list of people and fictional characters with the nickname
* Tex Earnhardt (1930–2020), U.S. businessman
* Joe Tex (1933–1982), stage name of American soul singer ...
and
LaTeX
Latex is an emulsion (stable dispersion) of polymer microparticles in water. Latices are found in nature, but synthetic latices are common as well.
In nature, latex is found as a wikt:milky, milky fluid, which is present in 10% of all floweri ...
, whose rendering engines are programmed to treat sequences of
whitespace characters
A whitespace character is a character (computing), character data element that represents White space (visual arts), white space when text string, text is
Rendering (computer graphics), rendered for display by a computer.
For example, a ''Space ...
(space, newline, tab,
form feed, etc.) as if they were a single character (but this behavior can be overridden). Such "collapsing" of whitespace allows the author to neatly arrange the source text using line breaks, indentation and other forms of spacing without affecting the final
typeset result.
In contrast, non-breaking spaces are not merged with neighboring whitespace characters when displayed. They can, therefore, be used by an author to simply insert additional visible space in the resulting output without using spans styled with peculiar values of the
CSS "white-space" property. Conversely, indiscriminate use (see the recommended use in
style guide
A style guide is a set of standards for the writing, formatting, and design of documents. A book-length style guide is often called a style manual or a manual of style. A short style guide, typically ranging from several to several dozen page ...
s), in addition to a normal space, gives extraneous space in the output.
Variations
Narrow non-breaking space
is another non-breaking space, but with a smaller width than the standard non-breaking space (U+00A0). When used with
Mongolian, its width is usually one third of the normal space; in other contexts, its width is about 70% of the normal space, but may resemble that of the
thin space
In typography, a thin space is a space character whose width is usually or of an em. It is used to add a narrow space, such as between nested quotation marks or to separate glyphs that interfere with one another. It is not as narrow as the hai ...
(U+2009), at least with some fonts.
It was introduced in Unicode 3.0 for Mongolian, to separate a suffix from the word stem without indicating a word boundary. It also triggers special shaping of those suffixes.
Starting in Unicode 16.0, it is no longer recommended for this purpose, with the Mongolian vowel separator (U+180E) being recommended for this purpose instead.
In
French typography, it is called
and is used before
;
,
?
, and
!
.
Additionally, footnotes are preceded by a narrow non-breaking space
(unless they are enclosed by parentheses, in which case a regular non-breaking space is used).
The narrow non-breaking space is used in numbers as a
group separator in French (starting in Unicode CLDR 34) and
Venetian (starting in Unicode CLDR 44). In Spanish, the
Royal Spanish Academy
The Royal Spanish Academy (, ; ) is Spain's official royal institution with a mission to ensure the stability of the Spanish language. It is based in Madrid, Spain, and is affiliated with national language academies in 22 other Hispanophon ...
and
Association of Academies of the Spanish Language's ''
Diccionario panhispánico de dudas'' prescribes the use of a small space as the number group separator, although this is not the case in Unicode's
Common Locale Data Repository
The Common Locale Data Repository (CLDR) is a project of the Unicode Consortium to provide locale data in XML format for use in computer applications. CLDR contains locale-specific information that an operating system will typically provide to ...
(CLDR).
Other variations
Other non-breaking variants
defined in Unicode.
;
:Produces a space equal to the figure (0–9) characters.
;
:Encoded in Unicode since version 3.2. The word joiner does not produce any space and prohibits a line break at its position.
Example
On browsers, resizing the window will demonstrate the effect of non-breaking spaces on the texts below.
To show the non-breaking effect of the non-breaking space, the following words have been separated with non-breaking spaces:
LoremIpsumDolorSitAmetConsecteturAdipiscingElitSedDoEiusmodTemporIncididuntUtLaboreEtDoloreMagnaAliquaUtEnimAdMinimVeniamQuisNostrudExercitationUllamcoLaborisNisiUtAliquipExEaCommodoConsequatDuisAute
To show the non-collapsing behavior of the non-breaking space, the following words have been separated with an increasing number of non-breaking spaces:
LoremIpsumDolorSitAmetConsecteturAdipiscingElitSedDoEiusmodTemporIncididuntUtLaboreEtDoloreMagnaAliquaUtEnimAdMinim
In contrast, the following words are separated with ordinary spaces:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Here, they are separated with narrow non-breaking spaces, to show the width of those:
LoremIpsumDolorSitAmetConsecteturAdipiscingElitSedDoEiusmodTemporIncididuntUtLaboreEtDoloreMagnaAliquaUtEnimAdMinimVeniamQuisNostrudExercitationUllamcoLaborisNisiUtAliquipExEaCommodoConsequatDuisAute
Unicode
*
*
*
*
See also
*
Hyphens in computing, for information about hard and non-breaking hyphens
*
List of XML and HTML character entity references
*
*
*
*
** , for applications
** , a non-spacing break
*
*
*
Notes
References
{{DEFAULTSORT:Non-breaking space
Control characters
Whitespace
Unicode formatting code points