Lists

CHAR(number) returns the character for a character-set code, most often used to insert characters you can't type directly into a formula: =CHAR(10) is a line break, =CHAR(9) is a tab, and =CHAR(34) is a literal double-quote mark. CODE(text) goes the other direction, returning the numeric code for a character's first letter. Standard printable ASCII runs from code 32 to 126; codes above that (up to 255, or into full Unicode with UNICHAR/UNICODE) cover accented letters and symbols like £ or ©.

The formula

=CHAR(10)              line break inside a text string (cell needs Wrap Text on to show it)
=CHAR(9)                a tab character
=CHAR(34)               a literal double-quote mark, e.g. ="He said "&CHAR(34)&"hi"&CHAR(34)
=CODE(A1)               the numeric code of the first character in A1 — the reverse of CHAR

A worked example

First name in A2 ("Priya"), city in B2 ("Austin"), and you want them on two lines inside one cell.

=A2&CHAR(10)&B2

"Priya" and "Austin" on separate lines inside the same cell — but only once Wrap Text is turned on (Home > Wrap Text); without it, the two values sit squeezed onto one visual line.

Which one do I need?

If you want to…Use
Inserting a line break inside a formula-built string=CHAR(10) — and turn on Wrap Text so the cell actually shows two lines
Putting literal quote marks inside a text formula=CHAR(34), since typing a " directly would end the text argument early
Cleaning data with invisible or non-printable characters (a stray CHAR(160) non-breaking space, tabs, etc.)=SUBSTITUTE(A1,CHAR(160)," ") for a specific code, or CLEAN(A1) for the general non-printable set
You have a character and need its numeric code, not the reverse=CODE(A1) for the first character, or =UNICODE(A1) for characters beyond code 255

Frequently asked questions

What's the difference between CHAR and CODE?

CHAR takes a number and returns the character: =CHAR(65) returns "A". CODE takes a character and returns its number: =CODE("A") returns 65. They are exact inverses.

Why doesn't CHAR(10) show as a line break in my cell?

The character is there, but the cell needs Wrap Text turned on (Home > Wrap Text) to display it as two lines instead of squeezing both onto one visual line.

Do CHAR and CODE work the same in Google Sheets?

Yes — both functions and every code in this guide (10 for a line break, 9 for a tab, 34 for a quote mark) behave identically in Google Sheets.

Is there a full reference of character codes?

Codes 32–126 are standard ASCII — letters, digits and punctuation. Codes 127–255 are the extended Windows-1252/ANSI set (accents, £, ©). Above 255, use UNICHAR()/UNICODE() instead of CHAR()/CODE() for full Unicode support.