Skip to content
Crop DeskFree tools for photos, PDFs & everyday work Search tools…/Search tools…/Search tools…/Get apps

Home › Guides

Unicode and UTF-8 for Hindi: Code Points, Bytes and How Devanagari Is Stored

By Mahendra Singh Deora · Published 23 November 2026 · 4 min read

When Hindi text breaks – boxes instead of letters, "lqcg" instead of सुबह, a form saying your name is "too long" – the cause is almost always encoding. This explainer covers the three layers you need to know as a CS/IT student or as anyone who types Hindi on computers: characters and code points (Unicode), bytes (UTF-8), and how Devanagari is stored and shown. The facts come from the Unicode Standard and IETF RFC 3629.

In short: Unicode gives every character a number (a code point). Devanagari uses the block U+0900–U+097F. UTF-8 stores each code point in 1 to 4 bytes, and every Devanagari character takes 3 bytes. Hindi is stored in phonetic order (consonant, then vowel sign), and the font rearranges it on screen.

Layer 1: code points

Unicode assigns each character a code point, written U+ followed by hexadecimal digits. Some Devanagari examples from the Unicode code chart:

CharacterCode pointName / role
कU+0915Consonant KA
नU+0928Consonant NA
िU+093FVowel sign I (shown on the left)
ेU+0947Vowel sign E
्U+094DSign virama (halant)

A code point is an abstract number. It says nothing about bytes, fonts or appearance. That separation is what lets the same text appear correctly in any Unicode font.

Layer 2: UTF-8 bytes

RFC 3629 defines UTF-8, the dominant encoding on the web. The number of bytes depends on the code point range:

Code point rangeBytesBit patternExamples
U+0000 – U+007F10xxxxxxxA–Z, 0–9 (same as ASCII)
U+0080 – U+07FF2110xxxxx 10xxxxxxAccented Latin, Greek, Arabic
U+0800 – U+FFFF31110xxxx 10xxxxxx 10xxxxxxAll Devanagari, ₹ (U+20B9)
U+10000 – U+10FFFF411110xxx 10xxxxxx 10xxxxxx 10xxxxxxEmoji

Worked example: नमस्ते

CharacterCode pointUTF-8 bytes
नU+0928E0 A4 A8
मU+092EE0 A4 AE
सU+0938E0 A4 B8
्U+094DE0 A5 8D
तU+0924E0 A4 A4
ेU+0947E0 A5 87

The word looks like 4 letters on screen, but it is 6 code points and 18 bytes in UTF-8. The English word "namaste" is 7 bytes. That is why a database column or form field limited by bytes fills up about three times faster with Hindi.

JavaScript adds a third count. MDN notes that a string's length counts UTF-16 code units. Every Devanagari character is one UTF-16 unit, so "नमस्ते".length is 6, while an emoji counts as 2. A form that limits "characters" may therefore count something different from what you see.

Layer 3: how Devanagari is stored and shown

Phonetic order

The Unicode Standard says Devanagari text "generally follows phonetic order": a consonant followed by a vowel sign is stored as the consonant first, then the vowel sign. The vowel sign ि (U+093F) is drawn to the left of its consonant, yet in memory it comes after it. In कि the bytes are क then ि. Typewriter-era fonts such as Kruti Dev did the opposite: you type the ि key first because it appears first. This mismatch is one of the main things a Kruti Dev to Unicode converter has to fix.

Virama and conjuncts

The virama (्, U+094D) "kills" the inherent vowel of a consonant. The Unicode Standard defines a dead consonant as a consonant followed by a virama. स + ् + त is stored as three code points, and the font decides whether to draw a half-letter or a ligature (स्त). The visual result can be one combined shape, but the text is still separate characters, which is why the cursor and backspace sometimes move "inside" a conjunct.

Fonts do the shaping

Converting code points into the right glyph shapes is the job of the font and the text-shaping engine. A missing or broken Devanagari font gives boxes or dotted circles (◌ि). The fix is a proper Unicode font such as Mangal or Noto Sans Devanagari. The data itself does not need to change.

Unicode vs legacy fonts (Kruti Dev)

UnicodeKruti Dev 010
What is storedDevanagari code points (U+09xx)Latin letters, for example lqcg
What makes it look HindiAny Devanagari fontOnly the Kruti Dev font
Search, sorting, spell-checkWorksDoes not work as Hindi
Web forms, email, phonesDisplays correctlyShows English gibberish
OCR outputUnicodeNot applicable

The Kruti Dev ↔ Unicode guide explains the conversion step by step. What is OCR explains why scanned Hindi needs a Devanagari OCR model.

Common encoding bugs and their causes

  • "नम..." gibberish – UTF-8 bytes read as a single-byte encoding (Windows-1252 or Latin-1). Each Hindi character turns into three odd Latin characters. Fix: open or declare the file as UTF-8.
  • Question marks "????" – the text was saved in an encoding that cannot represent Devanagari, and the characters were replaced permanently.
  • CSV opens garbled in a spreadsheet – the program guessed the wrong encoding. Import the file and choose UTF-8 explicitly.

Exercise

  1. In a browser console, run new TextEncoder().encode("नमस्ते").length (18) and "नमस्ते".length (6).
  2. Type कि in Unicode, then use your arrow keys and backspace on it and notice the order.
  3. Paste Kruti Dev text into the converter and compare the code points before and after.

Convert Kruti Dev text to Unicode and back.

Open the converter

Frequently asked questions

How many bytes is a Hindi character in UTF-8?

Every Devanagari code point (U+0900–U+097F) takes 3 bytes. A visible syllable such as स्ते can be several code points.

Why is ि typed after the consonant in Unicode?

Unicode stores Devanagari in phonetic order: consonant first, then the vowel sign, even though ि is drawn on the left.

Why do I see ठcharacters instead of Hindi?

UTF-8 bytes were read as a single-byte encoding. Open or import the file as UTF-8.

Sources

Sources checked on 23 November 2026. Official notices and orders change; the latest version on the issuing body's website is final.