In Excel, CHAR converts a number from the computer’s character set into a character. For example, with no cell references needed, =CHAR(65) returns A; use =CHAR(10) to insert a line break between text values, or =CHAR(34)&A2&CHAR(34) to surround the value in A2 with double quotation marks.
What the CHAR function does
CHAR is a text function: it takes a numeric character code and returns the corresponding character. It is useful when you need a character that is awkward to type, is invisible in a cell, or needs to be added consistently by a formula. The result is text, even when the character looks like punctuation or a space.
In Microsoft Excel for Microsoft 365 on Windows, CHAR uses the character set available to the system. The familiar codes for basic Latin letters and common control characters are widely used, but extended codes can depend on the character set or platform. That matters when a workbook moves between computers or is used in another spreadsheet application.
CHAR does not search for a character inside text, change a cell’s number format, or convert an entire number into text. It produces one character from one code. You can combine that result with cell references, text, and other functions using Excel’s concatenation operator, the ampersand (&).
Codes and limits to know
The number supplied to CHAR must be in the supported range of 1 through 255. A value outside that range returns the #VALUE! error. The number 32 represents an ordinary space, while 34 represents a double quotation mark. Many codes below 32 are control characters, which may not be visible when displayed on their own.
Some practical codes are:
- 9: a tab character.
- 10: a line feed, commonly used to start a new line within an Excel cell.
- 13: a carriage return, which is distinct from a line feed.
- 32: an ordinary space.
- 34: a double quotation mark.
- 39: an apostrophe.
Extended values such as 128 through 255 are less dependable as cross-platform character references. Their displayed characters may depend on the system’s character mapping. If you need a particular symbol or a character outside CHAR’s range, UNICHAR is usually the better choice.
Useful CHAR formula examples
For a basic test, enter a code directly into a formula. With no worksheet data required, =CHAR(65) returns the capital letter A. This is handy for checking a known code, but most working formulas combine CHAR with other text.
To put quotation marks around a cell value, assume A2 contains Maple. Enter =CHAR(34)&A2&CHAR(34) in B2. The result is "Maple", including the quotation marks. This can be useful when preparing a quoted label or a text snippet. It does not, by itself, create a complete CSV file: CSV quoting has additional rules, especially when a value contains quotation marks or commas.
To add apostrophes around a value, assume A2 contains West. Enter =CHAR(39)&A2&CHAR(39) in B2. The displayed result is ‘West’. If the value itself contains an apostrophe, the formula still adds the outside marks; it does not escape or double the apostrophe inside.
CHAR can also create a separator. If A2 contains a product code and B2 contains a description, put =A2&CHAR(9)&B2 in C2. It joins the two values with a tab character. A tab may not look like a neat column break inside a worksheet cell, and its appearance can vary in other programs. For a readable worksheet, separate columns are usually clearer; a tab can be useful when preparing text for another application that recognizes tabs.
Put text on separate lines in one cell
CHAR(10) is one of the most useful CHAR examples because it inserts a line feed. Suppose A2 contains a person’s name and B2 contains a department. In C2, enter =A2&CHAR(10)&B2. The result contains both pieces of text with a line break between them. To see the lines in the cell, select C2 and choose Home > Wrap Text. Without wrapping, the cell may not show the result as expected.
You can join more than two fields the same way. Suppose A2 contains a street address, B2 a city, and C2 a postal code. In D2, enter =A2&CHAR(10)&B2&", "&C2. If the cells contain 12 Pine Road, Riverton, and 20410, the result is two lines: 12 Pine Road on the first line and Riverton, 20410 on the second. The comma and space in the formula separate the city and postal code; CHAR(10) separates the address lines.
In Microsoft 365 for Windows, Home > Wrap Text is the relevant ribbon command. Excel for Mac also has a Wrap Text command on the Home tab, though ribbon layout can vary by release. A line break in a cell is different from making the row taller manually: wrapping controls whether the content is shown across multiple lines, while row height controls how much of that content is visible.
Clean text containing invisible characters
CHAR is useful for creating characters, but it can also help identify or remove them when paired with other functions. A common example is a nonbreaking space, which looks like an ordinary space but may prevent text from splitting or matching as expected. On Windows systems using the common Western character mapping, code 160 represents a nonbreaking space.
Assume A2 contains imported text with nonbreaking spaces. In B2, enter =SUBSTITUTE(A2,CHAR(160)," "). This replaces each CHAR(160) character with a regular space. For example, a value that visually appears as North [nonbreaking space] Shore becomes North Shore with an ordinary space. The result can then behave more predictably in searches or comparisons. Because code 160 is part of the extended character range, check the actual source data if a workbook is shared across different systems.
For a line break that arrived inside text, use SUBSTITUTE with CHAR(10). Assume A2 contains text with line feeds and you want a space instead. In B2, enter =SUBSTITUTE(A2,CHAR(10)," "). Each line feed is replaced with one ordinary space. This changes the formula’s displayed result, not the original value in A2. If the source also includes carriage returns, replacing CHAR(10) alone may not remove every break.
CHAR, UNICHAR, and CODE compared
These three functions have related names but different jobs. CHAR turns a supported character number into a character. UNICHAR returns the Unicode character for a numeric Unicode value, making it more suitable for symbols and characters that are not covered reliably by CHAR’s limited range. CODE works in the opposite direction for the first character in a text string: it returns that character’s numeric code in the system’s character set.
For instance, if A2 contains A, enter =CODE(A2) in B2; the result is 65 in the common character mapping. With B2 containing 65, =CHAR(B2) in C2 returns A. This round trip is useful for simple characters supported by the same mapping. It is not a general-purpose way to preserve every character in international text, because CODE and CHAR are limited compared with Unicode-aware functions.
For a Unicode symbol, suppose you want the euro sign and enter =UNICHAR(8364) in A1. It returns €. This is more suitable than relying on an extended CHAR code for that symbol. UNICHAR and UNICODE are available in modern Excel versions, including Microsoft 365; very old spreadsheet software may not support them. If a formula using them is shared with older versions, verify compatibility before relying on it.
A useful rule is to choose CHAR for familiar control characters and basic characters with dependable codes, especially line feeds and quotation marks. Choose UNICHAR when the target is a Unicode symbol or international character. Use CODE or UNICODE when you need to inspect a character’s numeric representation rather than create a character.
Common problems and troubleshooting
- The formula shows an error: Check that the argument is numeric and within 1–255. A text entry that looks like a number may need conversion, and numbers outside the range return
#VALUE!. - The line break is not visible: Confirm that the formula includes CHAR(10), then turn on Wrap Text and check the row height. The line break may be present even if the cell’s current display does not reveal it.
- The result looks blank: Some control characters are invisible by design. Test the formula in a larger text string or use a visible character such as CHAR(34) to confirm that the function is returning a result.
- Two strings look the same but do not match: One may contain a nonbreaking space, a line feed, or another hidden character. Replacing a known character with SUBSTITUTE can help, but first determine which character is present rather than removing spaces indiscriminately.
- An extended code gives a different symbol elsewhere: That is a character-mapping issue. For portable output, use UNICHAR for Unicode characters and verify how the receiving application handles the text.
CHAR returns text, so a cell containing a CHAR result may not behave like a number even if the character looks numeric. Also, a formula that produces a tab or line feed does not change the worksheet’s structure: it does not move content into another cell or create a new row.
Frequently Asked Questions
What does CHAR(10) do in Excel?
CHAR(10) returns a line-feed character, commonly used for a new line inside a cell. Join text with it using ampersands, then enable Home > Wrap Text if the separate lines are not visible.
How do I insert quotation marks with CHAR?
Use CHAR(34), the code for a double quotation mark in the common character set. With the value in A2, =CHAR(34)&A2&CHAR(34) returns the value surrounded by quotation marks.
Why does CHAR return #VALUE!?
The supplied number is outside CHAR’s supported range, is not being interpreted as a number, or otherwise cannot be used as a valid character code. Check the argument and use UNICHAR when you need a Unicode value beyond CHAR’s range.
Can CHAR create emojis or accented letters?
CHAR is not a reliable choice for the full range of modern text. Use UNICHAR with the appropriate Unicode value for characters outside CHAR’s supported set, and check that the target Excel version and receiving application support the character.
What is the difference between CHAR and CODE?
CHAR converts a number to a character, while CODE returns the number associated with the first character in a text value. For broader Unicode text, UNICHAR and UNICODE are the corresponding functions to consider.
Related
- How to Make a Custom Sorting List in Excel
- How to Strikethrough Numbers in Excel: Steps and Tips
- How to Make Serial Numbers in Excel: 4 Easy Methods
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Calculate Age in Excel as of Today: Formulas That WorkTo calculate age in completed years as of today, put each person’s date of birth in A2 and…
- XLOOKUP Match Mode: Exact, Approximate, and WildcardsIn Excel, XLOOKUP’s match_mode is its fifth argument: use 0 for an exact match, -1 for an exact…
- Excel Formula for Age From DOB: Years, Months, and DaysTo calculate age in completed years from a date of birth in cell A2, use =DATEDIF(A2,TODAY(),"Y"). It compares…
- Aggregate Functions in UPDATE: What SQL AllowsUsually, no: SQL does not allow an aggregate such as AVG() or SUM() directly as a row-level value…
- Excel Extend Number Sequence: Fill Series and FormulasTo extend a number sequence in Excel, enter its first two values, select both cells, then drag the…
- Find Month and Year From a Date in Excel with FormulasTo find a month and year from a date in Excel, enter =MONTH(A2) for the month number and…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.