CSS caret-color Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Forms & UI

What You’ll Learn

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.

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.

📝 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.

⚡ Quick Reference

QuestionAnswer
Initial valueauto
Applies toElements with text input (input, textarea, contenteditable)
InheritedYes
AnimatableBy computed color value
Common useBrand-colored cursors in forms and search fields

💎 Property Values

The caret-color property accepts standard CSS color values plus the keyword auto.

ValueExampleMeaning
autocaret-color: auto;Uses the default caret color, usually matching the text color.
Named colorcaret-color: red;Uses a CSS color keyword such as red, blue, or green.
Hex colorcaret-color: #ff5733;Uses a hexadecimal color value.
RGB or HSLcaret-color: hsl(9, 100%, 60%);Uses functional color notation.
currentColorcaret-color: currentColor;Uses the current value of the element’s color property.
red #ff5733 purple green

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.

👀 Live Preview

Click into each field to see the custom caret colors. The blinking cursor appears when the field is focused.

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: <input type="text">
</label>
Try It Yourself

How It Works

When the input is focused, the blinking insertion cursor appears in red instead of the default color.

Example 2 — Custom Caret in a Textarea

Apply caret-color to multi-line text areas for comments or message fields.

textarea-caret.html
<style>
  textarea {
    caret-color: #2563eb;
  }
</style>

<textarea rows="4" placeholder="Write your message..."></textarea>
Try It Yourself

How It Works

The caret color applies anywhere the user can type, including multi-line textarea elements.

🎨 Theme & Variables

Store your brand color once and reuse it for every form field caret.

Example 3 — Brand Color with CSS Variables

Use a CSS custom property so all form fields share one caret color.

theme-caret.css
:root {
  --brand-color: #7c3aed;
}

form {
  caret-color: var(--brand-color);
}
Try It Yourself

How It Works

Because caret-color is inherited, setting it on form styles every editable child with your brand purple.

Example 4 — Visible Caret on a Dark Input

Use a bright caret color so the cursor stays easy to see on dark backgrounds.

dark-caret.html
<style>
  .dark-input {
    background: #1e293b;
    color: #f8fafc;
    caret-color: #38bdf8;
    border: 1px solid #334155;
    padding: 0.55rem 0.65rem;
  }
</style>

<input type="search" class="dark-input" placeholder="Search...">
Try It Yourself

How It Works

A light blue caret on a dark field improves visibility compared to the default, which might blend into the background.

♿ 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.

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 Chrome 57+ · Desktop & Mobile
Full support
Mozilla Firefox 53+ · Desktop & Mobile
Full support
Apple Safari 11.1+ · macOS & iOS
Full support
Microsoft Edge 79+ · Chromium
Full support
Opera 44+ · Modern versions
Full support
caret-color property 97% supported

Bottom line: Use caret-color freely in modern projects. Unsupported browsers fall back to the default caret color.

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.

💡 Best Practices

✅ Do

  • 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

Key Takeaways

Knowledge Unlocked

Five things to remember about caret-color

Use these points when styling your next form.

5
Core concepts
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.

Practice in the Live Editor

Open the HTML editor, apply caret-color, and preview custom text cursors instantly.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful