Box-drawing character

From HandWiki
Short description: Unicode block group
Midnight Commander using box-drawing characters in a terminal emulator

Box-drawing characters, also known as line-drawing characters, are a form of semigraphics widely used in text user interfaces to draw various geometric frames and boxes. Box-drawing characters typically only work well with monospaced fonts. In graphical user interfaces, these characters are much less useful as it is more simple and appropriate to draw lines and rectangles directly with graphical APIs. However, they are still useful for command-line interfaces and plaintext comments within source code.

Used along with box-drawing characters are block elements, shade characters, and terminal graphic characters. These can be used for filling regions of the screen and portraying drop shadows.



Box Drawing

Unicode includes 128 such characters in the Box Drawing block.[1] In many Unicode fonts only the subset that is also available in the IBM PC character set (see below) will exist, due to it being defined as part of the WGL4 character set.

Box Drawing[1]
Official Unicode Consortium code chart (PDF)
  0 1 2 3 4 5 6 7 8 9 A B C D E F
1.^ As of Unicode version 13.0

The image below is provided as a quick reference for these symbols on systems that are unable to display them directly:

Unicode Box Drawings (2500 - 27FF).svg

Block Elements

The Block Elements Unicode block includes shading characters. 32 characters are included in the block.

Symbols for Legacy Computing

In version 13.0, Unicode was extended with another block containing many graphics characters, Symbols for Legacy Computing, which includes a few box-drawing characters and other symbols used by obsolete operating systems (mostly from the 1980s):

The image below is provided as a quick reference for these symbols on systems that are unable to display them directly:

Symbols for Legacy Computing Unicode block.png


The hardware code page of the original IBM PC supplied the following box-drawing characters, in what DOS now calls code page 437. This subset of the Unicode box-drawing characters is thus far more popular and likely to be rendered correctly:

0 1 2 3 4 5 6 7 8 9 A B C D E F

Their number is further limited to 22 on those code pages that replace the 18 characters that combine single and double lines with other, usually alphabetic, characters (such as code page 850):

0 1 2 3 4 5 6 7 8 9 A B C D E F

Note: The non-double characters are the thin (light) characters (U+2500, U+2502), not the bold (heavy) characters (U+2501, U+2503).

Some OEM DOS computers supported other character sets, for example the Hewlett-Packard HP 110 / HP Portable and HP 110 Plus / HP Portable Plus, where in a modified version of the character set box-drawing characters were added in reserved areas of their normal HP Roman-8 character set.[2][3]

[2][3] 0 1 2 3 4 5 6 7 8 9 A B C D E F

Unix, CP/M, BBS

On many Unix systems and early dial-up bulletin board systems the only common standard for box-drawing characters was the VT100 alternate character set (see also: DEC Special Graphics). The escape sequence Esc ( 0 switched the codes for lower-case ASCII letters to draw this set, and the sequence Esc ( B switched back:

0 1 2 3 4 5 6 7 8 9 A B C D E F

A Bash script that displays all of the semigraphic characters:

$ for i in 6a 6b 6c 6d 6e 71 74 75 76 77 78; do printf "0x$i \x$i \x1b(0\x$i\x1b(B\n"; done

0x6a j ┘
0x6b k ┐
0x6c l ┌
0x6d m └
0x6e n ┼
0x71 q ─
0x74 t ├
0x75 u ┤
0x76 v ┴
0x77 w ┬
0x78 x │

On some terminals, these characters are not available at all, and the complexity of the escape sequences discouraged their use, so often only ASCII characters that approximate box-drawing characters are used, such as - (hyphen-minus), | (vertical bar), _ (underscore), = (equal sign) and + (plus sign) in a kind of ASCII art fashion.

Modern Unix terminal emulators use Unicode and thus have access to the line-drawing characters listed above.


Many microcomputers of the 1970s and 1980s had their own proprietary character sets, which also included box-drawing characters. Some of these sets, such as Commodore's PETSCII, include box-drawing symbols with no corresponding Unicode character.


The Sinclair ZX80, ZX81 and Spectrum included a set of text semigraphics with block elements and dithering patterns in the ZX80 character set.

ZX81 semigraphics

BBC and Acorn

The BBC Micro could utilize the Teletext 7-bit character set, which had 128 box-drawing characters, whose code points were shared with the regular alphanumeric and punctuation characters. Control characters were used to switch between regular text and box drawing.[4]

Teletext G1 Block Mosaics Set:[5]

0 1 2 3 4 5 6 7 8 9 A B C D E F
2 NBSP TRS-80 character 0x81.png TRS-80 character 0x82.png TRS-80 character 0x83.png TRS-80 character 0x84.png TRS-80 character 0x85.png TRS-80 character 0x86.png TRS-80 character 0x87.png TRS-80 character 0x88.png TRS-80 character 0x89.png TRS-80 character 0x8A.png TRS-80 character 0x8B.png TRS-80 character 0x8C.png TRS-80 character 0x8D.png TRS-80 character 0x8E.png TRS-80 character 0x8F.png
3 TRS-80 character 0x90.png TRS-80 character 0x91.png TRS-80 character 0x92.png TRS-80 character 0x93.png TRS-80 character 0x94.png TRS-80 character 0x95.png TRS-80 character 0x96.png TRS-80 character 0x97.png TRS-80 character 0x98.png TRS-80 character 0x99.png TRS-80 character 0x9A.png TRS-80 character 0x9B.png TRS-80 character 0x9C.png TRS-80 character 0x9D.png TRS-80 character 0x9E.png TRS-80 character 0x9F.png
6 TRS-80 character 0xA0.png TRS-80 character 0xA1.png TRS-80 character 0xA2.png TRS-80 character 0xA3.png TRS-80 character 0xA4.png TRS-80 character 0xA5.png TRS-80 character 0xA6.png TRS-80 character 0xA7.png TRS-80 character 0xA8.png TRS-80 character 0xA9.png TRS-80 character 0xAA.png TRS-80 character 0xAB.png TRS-80 character 0xAC.png TRS-80 character 0xAD.png TRS-80 character 0xAE.png TRS-80 character 0xAF.png
7 TRS-80 character 0xB0.png TRS-80 character 0xB1.png TRS-80 character 0xB2.png TRS-80 character 0xB3.png TRS-80 character 0xB4.png TRS-80 character 0xB5.png TRS-80 character 0xB6.png TRS-80 character 0xB7.png TRS-80 character 0xB8.png TRS-80 character 0xB9.png TRS-80 character 0xBA.png TRS-80 character 0xBB.png TRS-80 character 0xBC.png TRS-80 character 0xBD.png TRS-80 character 0xBE.png TRS-80 character 0xBF.png

The BBC Master and later Acorn computers have the soft font by default defined with line drawing characters.

0 1 2 3 4 5 6 7 8 9 A B C D E F


The Amstrad CPC character set also has soft characters defined by default as block and line drawing characters.

0 1 2 3 4 5 6 7 8 9 A B C D E F

The CP/M Plus character set used on various Amstrad computers of the CPC, PCW and Spectrum families included a rich set of line-drawing characters as well:[6][7][8]

[6] 0 1 2 3 4 5 6 7 8 9 A B C D E F


MouseText is a set of display characters for the Apple IIc, IIe, and IIGS that includes box-drawing characters.


The World System Teletext (WST) uses pixel-drawing characters for some graphics. A character cell is divided in 2×3 regions, and 26 = 64 code positions are allocated for all possible combinations of pixels.[9] These characters were added to the Unicode standard in Version 13.[10]


Some recent embedded systems also use proprietary character sets, usually extensions to ISO 8859 character sets, which include box-drawing characters or other special symbols.

Character code

On many platforms, the character shape is determined programmatically from the character code.

  • ZX Spectrum block characters:
    0x80 + topright*1 + topleft*2 + bottomright*4 + bottomleft*8
  • Amstrad CPC block characters:
    0x80 + topleft*1 + topright*2 + bottomleft*4 + bottomright*8
  • Amstrad CPC line characters:
    0x90 + up*1 + right*2 + down*4 + left*8
  • BBC Master line characters:
    0xA0 + down*1 + right*2 + left*4 + up*8
  • Teletext block characters:
    0xA0 + topleft*1 + topright*2 + middleleft*4 + middleright*8 + bottomleft*16 + bottomright*64
  • DOS line draw characters are not ordered in any programmatic manner, and calculating a particular character shape needs to use a look-up table.


Sample diagrams made out of the standard box-drawing characters, using a monospaced font:

See also


  1. Box Drawing U+2500-U+257F, The Unicode Standard Code Charts
  2. 2.0 2.1 Hewlett-Packard - Technical Reference Manual - Portable PLUS (1 ed.). Corvallis, OR, USA: Hewlett-Packard Company, Portable Computer Division. August 1985. 45559-90001. Retrieved 2016-11-27. 
  3. 3.0 3.1 Hewlett-Packard - Technical Reference Manual - Portable PLUS (2 ed.). Portable Computer Division, Corvallis, OR, USA: Hewlett-Packard Company. December 1986. 45559-90006. Retrieved 2016-11-27. 
  4. Broadcast Teletext Specification, September 1976 (as HTML or scans of original document)
  5. Template:Bare URL PDF
  6. 6.0 6.1 "Appendix II: CP/M Plus character sets / II.1 The complete character set (Language 0)". Spectrum +3 CP/M Plus manual (User Manual). Retrieved 2017-07-10.  [1]
  7. "Amstrad Extended BIOS Internals". 2015-04-04. 
  8. "Amstrad CP/M Plus character set". 
  9. Wiels. "TeleText - Het Protocol" (in nl). Mosaic characters. 
  10. "Symbols for Legacy Computing".