← Blog · · ConvertCaseHQ Team · 6 min read

Case Sensitivity in Programming Languages: A Comparison

Most mainstream programming languages are case-sensitive: in JavaScript, Python, Java, C, C++, C#, Go, Rust and Ruby, total, Total and TOTAL are three different names. The main exceptions are SQL (for keywords and unquoted names), Visual Basic, Fortran and Pascal, which ignore case, plus PHP, which is case-sensitive for variables but not for function or class names.

In practice, many case bugs don't come from the language at all. They come from the layers around it: a file system that ignores case on your laptop but not on the build server, a URL that works in one capitalization only, a database that folds names. This comparison covers all of them, and each claim was checked against the relevant spec, official documentation or a compiler.

Case sensitivity in programming languages compared

LanguageCase-sensitive?Notes
JavaScriptYesMDN's example: früh and Früh are different variables.
PythonYesThe language reference says it in three words: "Case is significant."
JavaYesEven file names: a public class Foo must be in Foo.java, not foo.java.
C, C++Yesint total and int Total can sit side by side.
C#YesBut .NET's code analysis rule CA1708 flags public names that differ only by case, because other .NET languages may not be case-sensitive.
GoYes, and case has meaningAn uppercase first letter exports a name from its package.
RustYesThe compiler also warns when a name breaks the case conventions.
RubyYes, and case has meaningNames starting with a capital are constants, so class invoice is a syntax error.
HaskellYes, and case has meaningLowercase names are variables; capitalized names are types and constructors.
PHPPartlyVariables and constants are case-sensitive; functions, classes and keywords aren't.
SQLPartlyKeywords and unquoted identifiers aren't; quoted identifiers usually are. Details vary by database.
Visual Basic (.NET)NoABC and abc are the same element.
FortranNoKeywords and names can be written in any mix of case.
Pascal (Free Pascal)Nomyprocedure and MyProcedure are the same procedure.
NimPartlyOnly the first letter is case-sensitive, and underscores are ignored.

PHP: half and half

PHP's split rules are easy to trip over, because they differ inside a single file:

<?php
function sayHello() { return "hi"; }
echo SAYHELLO();   // "hi": function names ignore case

$name = "Ada";
echo $Name;        // Warning: Undefined variable $Name

Class names behave like functions, which matters for autoloading. The class may resolve as invoice or Invoice, but on Linux the file it lives in still has one exact name.

Visual Basic: insensitive, until it isn't

Microsoft's documentation adds a subtle warning. The Visual Basic compiler ignores case, but the .NET runtime binds names case-sensitively. Once you ship a library, other code refers to your public names in the exact case you published, so changing ABC to abc in a later version can break the code that uses it.

Nim: style-insensitive

Nim compares identifiers by their first letter exactly, then ignores case and underscores for the rest. It lets a snake_case library and a camelCase program call each other without arguing about style:

let fooBar = 1
echo foo_bar   # the same identifier: underscores are ignored
echo foobar    # also the same: case after the first letter is ignored
# echo FooBar  # a different identifier: the first letter counts

Markup, styles and data formats

  • HTML: element and attribute names are case-insensitive (for ASCII letters), so <DIV CLASS="x"> is the same as <div class="x">. Class names inside the attribute are a different matter, as the next point shows.
  • CSS: property names and keywords are case-insensitive, but class selectors are case-sensitive (except in quirks mode) and so are custom properties. More in our CSS naming guide.
  • XML: element and attribute names are case-sensitive.
  • JSON: keys are just strings, so {"id": 1, "ID": 2} parses into an object with two separate keys in both JavaScript's JSON.parse and Python's json.loads.
  • SQL identifiers: PostgreSQL folds unquoted names to lowercase, Oracle to uppercase, and MySQL's table names follow the server's file system. Our SQL naming post has the full table.

URLs, domains, HTTP headers and environment variables

  • URLs: RFC 3986 makes the scheme and host case-insensitive (HTTP://www.EXAMPLE.com/ equals http://www.example.com/) and treats the other parts as case-sensitive unless the scheme says otherwise. Whether /About and /about serve the same page is up to the server, but Google treats them as two different URLs, so pick lowercase and redirect the rest.
  • Percent-encoding: the hex digits are case-insensitive, so %3a and %3A are equivalent. Uppercase is the normalized form.
  • Domain names: case-insensitive, as RFC 4343 spells out. Email addresses are a longer story, covered in our post on case in domains and emails.
  • HTTP header names: case-insensitive under RFC 9110, so Content-Type and content-type are the same field.
  • Environment variables: case-sensitive on Linux and macOS, case-insensitive on Windows. A script that sets Path and reads PATH will behave differently on each.

File systems: where case bugs like to hide

  • Linux: case-sensitive. FOO.txt and foo.txt are two files.
  • Windows (NTFS): case-insensitive by default. Since Windows 10 build 17107, a directory can be made case-sensitive with fsutil.exe file setCaseSensitiveInfo <path> enable, mainly for working with Linux files under WSL. Microsoft's case sensitivity guide explains the details.
  • macOS (APFS): the default APFS format isn't case-sensitive; Disk Utility offers a separate "APFS (Case-sensitive)" format.

The classic result is an import that works on a developer's Mac and fails on a Linux build server:

// The file on disk is components/Header.js
import Header from "./components/header";
// Works on a default macOS or Windows disk.
// Fails on Linux: there is no file called header.js.

TypeScript's forceConsistentCasingInFileNames option catches this early by raising an error when an import's casing differs from the file on disk. Git has its own setting, core.ignoreCase, which git clone and git init switch on automatically on case-insensitive file systems. That's why renaming header.js to Header.js in Finder or Explorer may not register as a change. Renaming through Git in two steps always works:

git mv header.js header-tmp.js
git mv header-tmp.js Header.js

Comparing strings without caring about case

When your own code needs to ignore case, lowercasing both sides is the usual first step, but it isn't always enough. German ß uppercases to SS, and Turkish has a dotted and a dotless i. Use the tools built for the job:

// JavaScript
"a".localeCompare("A", undefined, { sensitivity: "base" }); // 0, meaning equal
"I".toLocaleLowerCase("tr");                                // "ı" (dotless i)
# Python
"Straße".casefold() == "STRASSE".casefold()  # True
"Straße".lower() == "STRASSE".lower()        # False

For a quick search across pasted text, our find and replace tool has a case-insensitive option, so userid finds userId, UserID and USERID in one pass.

A checklist for case-safe projects

  • Keep file and folder names lowercase, or make every import match the disk exactly, and switch on the checks your tools offer.
  • Serve lowercase URLs and redirect other capitalizations to them.
  • Don't give two public names the same spelling with different case; something downstream may not tell them apart.
  • Write SQL names in lowercase and never quote them.
  • Normalize before comparing user input, and reach for casefold() or locale-aware comparison when the text isn't plain English.

© 2026 ConvertCaseHQ. All rights reserved.