The caret-color property customizes the blinking text cursor in inputs and textareas. It is a small detail that can improve visibility and help form fields match your site’s color scheme.
01
Text Caret
Blinking insertion cursor.
02
Syntax
Any CSS color value.
03
auto Default
Matches text color.
04
Inputs
Text fields and areas.
05
Brand Colors
Variables and themes.
06
vs cursor
Not the mouse pointer.
Fundamentals
Definition and Usage
The caret-color CSS property lets you customize the color of the text caret — also known as the text insertion cursor — in an input field, textarea, or other editable element.
By using this property, you can enhance the user experience by making the caret more visible or by matching it to your website’s color scheme. It applies to any element that accepts text input.
💡
Beginner Tip
Do not confuse caret-color with the cursor property. caret-color styles the blinking line where you type; cursor styles the mouse pointer icon.
Foundation
📝 Syntax
The syntax for caret-color is straightforward — the value is any valid CSS color:
syntax.css
selector{caret-color:color;}
Basic Example
caret-color.css
input[type="text"]{caret-color:red;}
Syntax Rules
The initial value is auto.
Accepts any valid CSS color: named, hex, rgb, hsl, or currentColor.
Works on editable elements: inputs, textareas, and contenteditable.
The property is inherited, so you can set it on a parent form.
Pair with sufficient text/background contrast for readability.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Initial value
auto
Applies to
Elements with text input (input, textarea, contenteditable)
Inherited
Yes
Animatable
By computed color value
Common use
Brand-colored cursors in forms and search fields
Reference
💎 Property Values
The caret-color property accepts standard CSS color values plus the keyword auto.
Value
Example
Meaning
auto
caret-color: auto;
Uses the default caret color, usually matching the text color.
Named color
caret-color: red;
Uses a CSS color keyword such as red, blue, or green.
Hex color
caret-color: #ff5733;
Uses a hexadecimal color value.
RGB or HSL
caret-color: hsl(9, 100%, 60%);
Uses functional color notation.
currentColor
caret-color: currentColor;
Uses the current value of the element’s color property.
red#ff5733purplegreen
Scope
Supported Elements
caret-color affects the text insertion caret in editable fields. Common targets include:
<input type="text">, email, search, url, and other text-based inputs
<textarea> — multi-line text areas
contenteditable elements — rich text regions users can edit
Set caret-color on individual fields or on a parent form so every child input inherits the same cursor color.
Preview
👀 Live Preview
Click into each field to see the custom caret colors. The blinking cursor appears when the field is focused.
Hands-On
Examples Gallery
Try a red text input, textarea styling, theme variables, and a dark form field.
📝 Basic Caret Colors
Start with a simple color on a text input — the same pattern from the reference example.
Example 1 — Red Caret in a Text Input
Change the caret color in a text input field to red.
red-caret.html
<style>input[type="text"]{caret-color:red;}</style><label>
Type something: <inputtype="text"></label>
A light blue caret on a dark field improves visibility compared to the default, which might blend into the background.
A11y
♿ Accessibility
Keep the caret visible — Choose a caret color with enough contrast against the input background.
Do not rely on color alone — Labels, placeholders, and focus outlines still matter for usability.
Test focus states — Ensure the caret and focus ring are both easy to see when keyboard navigating.
Match text when unsure — Using currentColor or auto keeps the caret aligned with readable text.
🧠 How caret-color Works
1
User focuses an editable field
An input, textarea, or contenteditable element becomes active and ready for typing.
User interaction
2
You set caret-color in CSS
Apply any valid color with caret-color on the field or a parent container.
CSS rule
3
The browser draws the caret
The blinking insertion cursor uses your chosen color at the current text position.
Rendering
=
✎
Branded, visible typing cursor
Users see a caret that matches your design and stays easy to spot while typing.
Compatibility
Universal Browser Support
The caret-color property is supported in most modern browsers, including Chrome, Firefox, Safari, Edge, and Opera.
✓ Baseline · Modern browsers
Custom carets in today’s browsers
Chrome, Firefox, Safari, Edge, and Opera all support caret-color on editable elements.
97%Modern browser support
Google Chrome57+ · Desktop & Mobile
Full support
Mozilla Firefox53+ · Desktop & Mobile
Full support
Apple Safari11.1+ · macOS & iOS
Full support
Microsoft Edge79+ · Chromium
Full support
Opera44+ · Modern versions
Full support
caret-color property97% supported
Bottom line: Use caret-color freely in modern projects. Unsupported browsers fall back to the default caret color.
Wrap Up
Conclusion
The caret-color property is a useful tool for improving the user experience by customizing the appearance of the text caret. By changing the caret color, you can make it more visible or better match your website’s design.
Experiment with different colors and see how this property can enhance the look and feel of your form fields and text areas.
Use caret-color to match form fields to your brand palette
Set it on a parent form when many fields share one color
Use bright carets on dark input backgrounds for visibility
Pair with clear focus outlines for keyboard users
Use CSS variables for theme-wide caret colors
❌ Don’t
Confuse caret-color with the cursor property
Use low-contrast caret colors that are hard to see
Assume caret color alone improves form accessibility
Hide focus indicators and rely only on caret styling
Forget to test on mobile devices where carets also appear
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about caret-color
Use these points when styling your next form.
5
Core concepts
✎01
Text Caret
Blinking cursor color.
Purpose
⚙02
auto Default
Matches text color.
Default
🖌03
Color Values
Named, hex, rgb, hsl.
Values
📝04
Inherited
Set on parent form.
Cascade
🛸05
Not cursor
Mouse pointer differs.
Compare
❓ Frequently Asked Questions
caret-color sets the color of the text caret — the blinking insertion cursor — in editable fields such as text inputs, textareas, and contenteditable elements.
The initial value is auto. With auto, the browser chooses the caret color, which usually matches the text color.
It works on elements that accept text input, including input types like text, email, and search, plus textarea and contenteditable elements.
caret-color styles the blinking text insertion point inside editable fields. The cursor property styles the mouse pointer icon when hovering over an element.
Yes. You can set caret-color to var(--brand-color) or any other valid CSS color value, including named colors, hex, rgb, and hsl.