Greek Letters in HTML and JavaScript

JavaScript FAQ | JavaScript Strings and RegExp FAQ  

Question: Can I display Greek letters on my page as part of JavaScript output?

Answer: You can include Greek letters in JavaScript strings and/or display Greek letters on your webpage using several representations:

  • hexadecimal codes
\uXXXX
in JavaScript strings; e.g. small alpha (α) is
\u03B1
  • numeric HTML entities; for example, small alpha is
α
  • HTML entities; for example, small alpha is
α
unescape
with a suitable argument; e.g. small alpha is
unescape('%u03B1')
decodeURI
with a suitable argument; e.g. small alpha is
decodeURI('%CE%B1')
Here is a simple test for the Greek letter pi (π):
document.write('C = 2\u03C0R')      // 

document.write('C = 2πR')      // 

document.write('C = 2πR')        // 

document.write(unescape('%u03C0'))  // 

document.write(decodeURI('%CF%80')) // 

To display Greek letters in a JavaScript alert message or a confirm dialog box, use hexadecimal codes, for example:

alert('\u03A9 is the last letter of the alphabet.') //Try it!

The following table lists HTML entities, character codes, and URL-encodings for Greek letters in alphabetical order. Some letter variants do not have HTML entities; for example,

ϓ
(
ϓ
) or
ϕ
(
ϕ
). These letter variants are omitted.
chr 
\uXXXX  
Numeric   HTML entity 
escape(chr) 
encodeURI(chr)
Α
\u0391
Α
  Α
  %u0391
 %CE%91
Β
\u0392
Β
  Β
  %u0392
 %CE%92
Γ
\u0393
Γ
  Γ
  %u0393
 %CE%93
Δ
\u0394
Δ
  Δ
  %u0394
 %CE%94
Ε
\u0395
Ε
  Ε
  %u0395
 %CE%95
Ζ
\u0396
Ζ
  Ζ
  %u0396
 %CE%96
Η
\u0397
Η
  Η
  %u0397
 %CE%97
Θ
\u0398
Θ
  Θ
  %u0398
 %CE%98
Ι
\u0399
Ι
  Ι
  %u0399
 %CE%99
Κ
\u039A
Κ
  Κ
  %u039A
 %CE%9A
Λ
\u039B
Λ
  Λ
  %u039B
 %CE%9B
Μ
\u039C
Μ
  Μ
  %u039C
 %CE%9C
Ν
\u039D
Ν
  Ν
  %u039D
 %CE%9D
Ξ
\u039E
Ξ
  Ξ
  %u039E
 %CE%9E
Ο
\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83
τ
\u03C4
τ
  τ
  %u03C4
 %CF%84
υ
\u03C5
υ
  υ
  %u03C5
 %CF%85
φ
\u03C6
φ
  φ
  %u03C6
 %CF%86
χ
\u03C7
χ
  χ
  %u03C7
 %CF%87
ψ
\u03C8
ψ
  ψ
  %u03C8
 %CF%88
ω
\u03C9
ω
  ω
  %u03C9
 %CF%89
Alphabetical order differs from the character code order for these letters:
ϑ
\u03D1
ϑ
  ϑ
  %u03D1
 %CF%91
ϒ
\u03D2
ϒ
  ϒ
  %u03D2
 %CF%92
ϖ
\u03D6
ϖ
  ϖ
  %u03D6
 %CF%96

See also:

 

 

Copyright © 1996-2018, JavascriptFAQ.net.