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.
Encodings
Unicode
includes 128 such characters in the Box Drawing block. In many Unicode fonts only the subset that is also available in the IBM PCcharacter set will exist, due to it being defined as part of the WGL4 character set. The Block Elements Unicode block includes shading characters. 32 characters are included in the block. In version 13.0, Unicode was extended with another block containing many box-drawing characters, Symbols for Legacy Computing, which includes box-drawing characters and other symbols used by obsolete operating systems :
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
B
│
┤
╡
╢
╖
╕
╣
║
╗
╝
╜
╛
┐
C
└
┴
┬
├
─
┼
╞
╟
╚
╔
╩
╦
╠
═
╬
╧
D
╨
╤
╥
╙
╘
╒
╓
╫
╪
┘
┌
Their number is further limited to 22 on those code pages that replace the 18 "single/double hybrid" characters with other, usually alphabetic, characters :
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
B
│
┤
╣
║
╗
╝
┐
C
└
┴
┬
├
─
┼
╚
╔
╩
╦
╠
═
╬
D
┘
┌
Note: The non-double characters are the "thin" ones, not the "bold" ones. Some OEM DOS computers supported other character sets, for example the Hewlett-PackardHP 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.
On many Unix systems and early dial-up bulletin board systems the only common standard for box-drawing characters was the VT100alternate character set. The escape sequenceEsc , | , _, = and + in a kind of ASCII art fashion. Modern Unix terminal emulators use Unicode and thus have access to the line-drawing characters listed above.
Historical
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.
The BBC Micro could utilise 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. 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
A
╷
╶
┌
╴
┐
─
┬
╵
│
└
├
┘
┤
┴
┼
B
╭
╮
╰
╯
The Amstrad CPC 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
8
▘
▝
▀
▖
▍
▞
▛
▗
▚
▐
▜
▃
▙
▟
▉
9
╵
╶
└
╷
│
┌
├
╴
┘
─
┴
┐
┤
┬
┼
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:
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
8
╧
╟
╚
╤
║
╔
╠
╢
╝
═
╩
╗
╣
╦
╬
9
╵
╶
└
╷
│
┌
├
╴
┘
─
┴
┐
┤
┬
┼
MouseText is a set of display characters for the Apple IIc, IIe, and IIgs that includes box-drawing characters. 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. The World System Teletext 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". These characters were added to the Unicode standard in Version 13.
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 linedraw characters are not ordered in any programmatic manner, and calculating a particular character shape needs to use a look-up table.
Examples
Sample diagrams made out of the standard box-drawing characters, using a monospaced font: