css-inline
High-performance library for inlining CSS into HTML 'style' attributes
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has no known vulnerabilities, supports current Python versions (3.10+), and solves a specific and common problem (CSS inlining for email and embedded HTML) with a permissive license. Medium install friction is acceptable given the availability of pre-built wheels for most platforms. Suitable for production email systems and HTML embedding workflows.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or higher; pre-built wheels available for most platforms, but Rust 1.65+ needed to build from source on unsupported architectures.
- Medium install friction due to compiled Rust bindings, but pre-built wheels cover most common platforms (Linux, macOS, Windows, WebAssembly).
- Requires Rust 1.65+ only if building from source on unsupported platforms.
License · maintenance · safety
permissive license (permissive) — Licensed under MIT (permissive), allowing unrestricted use, modification, and distribution in both open-source and proprietary projects.
last release 2026-08-08 (6 days) · last repo commit 2026-08-13 · 315 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 3,143,174 downloads/mo, #2,730 on PyPI
Alternatives
Verify before relying
pip install css_inline
import css_inline
HTML = "<style>h1 { color: blue; }</style><h1>Text</h1>"
inlined = css_inline.inline(HTML)- Whether the 10-500x performance claim versus alternatives is independently verified or measured under specific conditions.
- Whether stylesheet caching actually reduces network overhead in typical email-generation workflows.
- Whether parallel processing via inline_many provides measurable speedup on typical multicore systems.
What it is and what it does
css_inline is a high-performance library that transforms CSS rules from style and link tags into inline style attributes on HTML elements. It's built on Mozilla's Servo project components and is designed for scenarios like preparing HTML emails or embedding HTML into third-party web pages where external stylesheets cannot be used. The library handles CSS resolution, can load external stylesheets (including from the filesystem), and optionally caches them to reduce repeated network requests.
It offers both simple one-shot functions (inline, inline_fragment) and batch processing (inline_many, inline_many_fragments) for concurrent document processing. Configuration options let you control whether to keep or remove style/link tags, minify CSS, apply width/height attributes, and skip inlining for specific elements via data attributes. It supports HTML5 and CSS3, works on Linux, Windows, macOS, and in the browser via PyOdide, and is tested on CPython 3.10–3.14 and PyPy 3.11.
Use it for
- Prepare HTML emails by inlining all CSS so styles render correctly in email clients that strip external stylesheets.
- Embed HTML snippets into third-party web pages where external CSS links are not allowed or would conflict.
- Batch-process multiple HTML documents concurrently to improve throughput when generating many styled documents.
- Generate responsive emails by keeping @media queries in style tags while inlining base styles into elements.
- Load and cache stylesheets from the filesystem or remote URLs to avoid repeated network requests during bulk HTML generation.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has no known vulnerabilities, supports current Python versions (3.10+), and solves a specific and common problem (CSS inlining for email and embedded HTML) with a permissive license. Medium install friction is acceptable given the availability of pre-built wheels for most platforms. Suitable for production email systems and HTML embedding workflows.
Install
css-inline on PyPI
Before you install
Medium install friction due to compiled Rust bindings, but pre-built wheels cover most common platforms (Linux, macOS, Windows, WebAssembly). Requires Rust 1.65+ only if building from source on unsupported platforms. Active maintenance with a release 6 days ago.
Requires Python 3.10 or higher; pre-built wheels available for most platforms, but Rust 1.65+ needed to build from source on unsupported architectures.
License in practice
Licensed under MIT (permissive), allowing unrestricted use, modification, and distribution in both open-source and proprietary projects.
Quickstart
pip install css_inline
import css_inline
HTML = "<style>h1 { color: blue; }</style><h1>Text</h1>"
inlined = css_inline.inline(HTML)
Verify before relying
- Whether the 10-500x performance claim versus alternatives is independently verified or measured under specific conditions.
- Whether stylesheet caching actually reduces network overhead in typical email-generation workflows.
- Whether parallel processing via inline_many provides measurable speedup on typical multicore systems.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 6 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,143,174 / month, #2,730 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyProgramming Language :: Rust |
Evidence: css_inline-0.21.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl; css_inline-0.21.1-cp310-abi3-macosx_10_12_x86_64.whl; css_inline-0.21.1-cp310-abi3-manylinux_2_12_i686.manylinux2010_i686.whl; css_inline-0.21.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; css_inline-0.21.1-cp310-abi3-manylinux_2_24_aarch64.whl; css_inline-0.21.1-cp310-abi3-manylinux_2_24_armv7l.whl; css_inline-0.21.1-cp310-abi3-musllinux_1_2_aarch64.whl; css_inline-0.21.1-cp310-abi3-musllinux_1_2_armv7l.whl; css_inline-0.21.1-cp310-abi3-musllinux_1_2_x86_64.whl; css_inline-0.21.1-cp310-abi3-pyemscripten_2025_0_wasm32.whl; css_inline-0.21.1-cp310-abi3-win32.whl; css_inline-0.21.1-cp310-abi3-win_amd64.whl; css_inline-0.21.1-pp311-pypy311_pp73-macosx_10_12_x86_64.whl; css_inline-0.21.1-pp311-pypy311_pp73-manylinux_2_24_aarch64.whl; css_inline-0.21.1-pp311-pypy311_pp73-manylinux_2_24_x86_64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “css inlining for html”
- css-inlineInlines CSS from style and link tags directly into HTML element style…
- premailerConverts CSS style blocks into inline style attributes on HTML…
- pynlinerConverts CSS stylesheets to inline styles in HTML documents, using…
Give your agent the search over MCP, or paste the wish link into any chat.
More HTML packages
MarkupSafe provides a text object that escapes special characters so untrusted strings can be safely embedded in HTML and XML without injection attacks.
Jinja2 is a templating engine that renders dynamic content by combining templates with Python-like syntax and data, supporting template inheritance, macros, autoescaping, and sandboxed execution.
Beautiful Soup parses HTML and XML documents into a navigable tree, providing Pythonic methods to search, iterate, and modify the parsed content.
Install it if you need to parse or extract data from markup documents.
lxml provides Python bindings to libxml2 and libxslt, enabling parsing, validation, and transformation of XML and HTML documents through an ElementTree-compatible API with support for XPath, XSLT, and schema validation.
Install it if you need robust XML/HTML parsing, validation, or transformation; avoid it only if you must stay pure-Python and can accept slower performance.
Docutils converts plaintext documentation in reStructuredText format into multiple output formats including HTML, XML, and LaTeX using a modular processing system.
Converts Markdown text to HTML using a Python implementation of John Gruber's Markdown specification, with support for extensions.
Install it if you need to parse Markdown in Python.
See also pynliner · django-premailer · premailer · email-to · emails · cssutils · html-text · dict2css · html-for-docx · mrml